How to view and edit CSV and Excel files in VS Code
Short answer: VS Code opens a . as plain text and can't open an . at all. Install a spreadsheet viewer extension to get a grid you can search, sort, filter and edit. This guide uses the free CSV & Excel viewer in DevSnip Pro: it opens ., . and . files as an editable grid, runs locally and keeps every cell you didn't touch exactly as it was.
Data files turn up in every project: a CSV export to check before an import, test fixtures, a product list from a colleague, a workbook of seed data. Reading 40 columns of comma-separated text is slow, and opening the file in a spreadsheet app has its own risk: when the file is saved again, the app can quietly reformat values such as long IDs, leading zeros or dates.
1. Open the file as a grid
- Excel workbooks (
.,xlsx .): click the file in the Explorer. It opens in the viewer.xlsm - CSV and TSV (
.,csv .,tsv .): right-click the file in the Explorer and choose Open in CSV & Excel Viewer, click the table button in the editor title bar, or use Open With….tab
You can also run DevSnip Pro: CSV / TSV Viewer or DevSnip Pro: Excel Viewer (.xlsx) from the Command Palette (Ctrl/Cmd+Shift+P).
The viewer detects a CSV's separator and encoding, so semicolon-separated exports and files in other encodings open correctly. In a workbook every sheet is available, and dates, times, percentages, currencies and number formats are shown the way Excel shows them, with each formula next to its value.
2. Find what you're looking for
- Search across all cells, then sort and filter by column. This stays fast with hundreds of thousands of rows.
- Column stats show how many cells are filled, empty and distinct, with the minimum, maximum, sum and average. They're a quick way to check an import: an ID column with fewer distinct values than rows has duplicates.
- Select cells to see their sum and average, as in Excel.
3. Edit safely
Nothing in the file can change until you press Edit. Then:
- Click a cell to edit its text, or select it and type over it.
- Paste a block of cells copied from Excel.
- Right-click to insert or delete rows and columns. A new column is named as you add it.
- Press Ctrl/Cmd+S to save. Undo works as it does in any editor.
Two details make this safer than a round trip through a spreadsheet app:
- Untouched rows are saved exactly as they were. Values you didn't edit keep their original text, so IDs, leading zeros and date strings are not reformatted.
- Workbooks keep everything you didn't change: other cells, styles, charts and macros. Macros are never run.
4. Convert and share what you see
Export writes the current view (after your sorting and filters) as:
| Format | Useful for |
|---|---|
| CSV | A cleaned-up or filtered copy of the data |
| JSON | Test fixtures, seed data or a mock API response |
| Markdown table | A README, a pull request description or an issue |
You can also copy cells and paste them straight into Excel.
Limits worth knowing
- Old binary
.workbooks aren't supported. Save them asxls .first.xlsx - Formulas are shown with their values, but the viewer is not a full spreadsheet application: for heavy formula work, use Excel or a similar tool.
- Everything runs inside VS Code. The file is never uploaded anywhere.
A workflow for data files in a repository
- Open the CSV in the viewer and check the column stats before you write an import script.
- Filter down to the rows your test needs and export them as JSON for a fixture.
- Fix a bad value in Edit mode and save: rows you didn't touch are written back byte for byte, so the diff in source control shows only the rows you changed.