26

Opening a .csv file in Visual Studio produces an unreadable jumbled mess. Is there any way to set up Visual Studio to automatically format these files in columns (a "grid-view", so to speak) so I can edit them directly in the IDE? Are there any tricks or workarounds or extensions that could make these files more easily readable?

(VSCode has what looks to be a fantastic extension for this sort of thing, but alas, it won't work in Visual Studio Pro/Enterprise. Also, BeyondCompare4 does this automatically, and Notepad++ has the TextFX plugin which supports this as well. Has no one ever produced such a plugin for VS?)

(UPDATE: I have created a feature request here. Please vote for it if you upvote this ticket.)

kmote
  • 16,095
  • 11
  • 68
  • 91
  • Two VS extensions:https://marketplace.visualstudio.com/items?itemName=Pliable3.CSVObjectGenerator and https://marketplace.visualstudio.com/items?itemName=KellermanSoftware.NETCSVReports#overview, maybe it was helpful for you, if it was not the real extension you want to get, you could submit a feature request to the product team directly:http://visualstudio.uservoice.com/forums/121579-visual-studio. – Jack Zhai May 29 '18 at 07:33
  • Neither of those first two links provide the functionality described in my post. Submitting a feature request, however, is a great idea. I will update my ticket with a reference to the request when I create it. – kmote May 29 '18 at 15:09
  • It would be nice to easily right click 'open in excel'. Can you configure vs code to open certain file types with certain programs? – NicoWheat Jan 31 '20 at 22:41

2 Answers2

24

You can install csv-viewer extensions by searching for them in the search tool in the VSCode "Extensions" menu.

Some good ones are 'Excel Viewer' by GrapeCity, or 'Edit csv' by janisdd.

Both of these (and many more) allow you to view excel files in columns inside VScode, not just text files as is default.

NicoWheat
  • 2,157
  • 2
  • 26
  • 34
  • 3
    Unfortunately, as I mentioned in my post, the VSCode extensions don't work in VS Pro. :( – kmote Feb 13 '20 at 16:59
  • Oh, sorry :( I came back at a later date to answer this and didn't remember you said VS Pro. Hopefully people who are looking for this (who don't have VS pro) can be helped. If not, I can delete the answer. – NicoWheat Feb 13 '20 at 19:08
  • With VSCode "Excel Viewer" works nice with csv files. (If you have tab-delimited file, extension should be .tsv for the 'Excel Viewer' correctly assume delimiter). – Dimitry K Oct 12 '20 at 14:58
  • I've used that for weeks let me tell you. it's not good. you cant search the data properly. and it's risky if u didn't aware of it – greendino Jan 19 '21 at 03:45
  • I prefer "Edit csv" since I can edit. Also the interface uses larger fonts and borders, making it more usable (at least for me). – Arnab Biswas Mar 04 '21 at 06:05
0

Without extension, VSCode 1.44 (March 2020) might bring a native answer with:

Custom Text Editors

With custom text editors, extensions can now replace VS Code's standard editor with a custom webview based view for specific text based resources. Potential use case include:

  • Previewing assets, such as shaders or .obj files.
  • Creating WYSIWYG editors for markup languages such as XAML.
  • Providing alternative, interactive views of data files such as json or csv.

The custom editors documentation covers how to use the new custom text editor API and how to make sure your new editor works well with VS Code. Also be sure to check out the custom editors extension sample.

https://raw.githubusercontent.com/microsoft/vscode-extension-samples/custom-editor-examples/custom-editor-sample/documentation/example.png

And that comes with:

workbench.editorAssociations setting

Also for custom editor, the new workbench.editorAssociations setting lets you configure which editor is used for a specific resource.

The example below configures all files ending in .catScratch to open using the example custom text editor from our extension samples.

"workbench.editorAssociations": [
  {
    "viewType": "catCustoms.catScratch",
    "filenamePattern": "*.catScratch"
  }
]

And:

View: Reopen with

The new View: Reopen with command lets you reopen the currently active file using a different custom editor.

Using 'Reopen With' with the custom editor example extension -- https://media.githubusercontent.com/media/microsoft/vscode-docs/vnext/release-notes/images/1_44/reopen-with.png

You can use this command to switch between VS Code's standard text editor and the custom editor, or to switch between multiple custom editors for a resource.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250