I work with CSV files a lot, and Excel is overkill for that. Does anyone know a good, lightweight CSV viewer/editor I can use? Ideally it should be free or cheap. I found Ron's Editor, which works amazingly, but is way too expensive.
This extensions allows you to edit csv files with an excel like table ui
Web version
If you don't have vs code to hand, you can use the online version at https://edit-csv.net
- Create a CSV file from scratch. Edit a CSV file. You can format CSV online: add columns, rows, and also change the delimiter (convert CSV to TSV), quote or escape characters. Export to a CSV file or to the clipboard. Share a CSV file. You can see the user guide to help you to use this CSV editor.
- What is the Easy CSV Editor? The Easy CSV Editor is a powerful text editor designed specifically for CSV or TSV tables and spreadsheets. Besides editing, it.
- You may load your data from disk - see Choose CSV file here below. You may load your data from a web address - see Enter an URL below. You may also paste your data. The separator will be detected automatically when pasting. Save your data to a CSV File or in Excel format. Copying and pasting from Excel and other spreadsheet tools should work.
Features
Execute the command edit as csv
to open an editor for the current file.
Execute the command again to switch back to the source file or to switch back to the editor
Note that the data flow is one way (editor to source file). If you make changes to the source file (.csv) while the editor is open, the editor will not be updated!
ยก Important Notes !
On initial load all rows are expanded so that all rows have equal length (number of cells (if necessary))
- if that happens you will see the
unsaved changes
indicator right from the start
- if that happens you will see the
enabling/disabling the
has header
read option will clear the undo/redo stack!empty lines are skipped!
- this will not trigger the
unsaved changes
indicator - (during parsing) a row is also empty when it only contains
'
- this can be problematic if you have only 1 column...
- this will not trigger the
We try to retain quote information (default) but in some cases fields could get unquoted on save (see Retain Quote Information Rules)
Comment row (rows starting with a comment) will only export the first cell
- if you accidentally added comment text to a cell other than the first cell you will notice it (color)
Adding new lines to comments rows (via alt + enter) will have no effect when exporting (lines breaks are removed in comments!)
- leading spaces will be removed in comment rows!
Starting with Version 0.1.0 the table has a context menu (right-click the table)
- (just mentioning it because it is not obvious via the ui)
Plugin Version 0.0.11 had an issue with loading and saving files with more than ~1 MB
- saved files were corrupted (content of the first ~1MB was repeated after the first ~1MB until the file size was reached)
Retain Quote Information Rules
during parsing information about the quotes are stored
- quote information is only stored for columns
- only the first non-comment, not empty row (no fields) is used to gather quote information
- if the first row has less cells than other rows
- then missing entries are filled with
csv-edit.newColumnQuoteInformationIsQuoted
(default is not quoted)
- then missing entries are filled with
- manually added columns will get
csv-edit.newColumnQuoteInformationIsQuoted
quote information - moving columns will also 'move' the quote information
- e.g. column 3 was quoted and is now column 1 then column 1 is quoted after moving
Implications of this
- columns with mixed cells (quoted and not quoted fields) will get homogeneously quoted
This can be turned off by setting csv-edit.retainQuoteInformation
to false
In this case all unnecessary quotes are removed
How this extension works
essentially it's just import csv and export csv
When you click on edit csv file
the file content is cut into pieced and transferred via
[webview].postMessage
the current config is stringified and injected into the editor (webview) html
a manager stores a reference to the webview, source file uri, editor uri
in the webview the pieces are put together and the text is parsed as csv and displayed in the (handson) table element
When you click on apply
the current table is transformed into csv, transferred via
vscode.postMessage
to the extension and written to the source file- if you clicked on
apply
by accident, you can undo the changes in the table element (with the usual shortcuts) and apply again or open the source file and just do an undo (with the usual shortcuts)
- if you clicked on
When you click on
apply and save
- the first step is equal to
apply
- then the source file is saved
- the first step is equal to
When you click in
Read again
- the injected content is used (when the editor was opened), this does not read the source file again
As you can see this does not scale very well with large csv files (needs to be stringified and stored the whole time)
Extension Settings
There are some settings for this plugin. Open the VS Code Settings and search for csv-edit
File extension xyz is not recognized by the vs code extension
See https://code.visualstudio.com/docs/languages/overview#_adding-a-file-extension-to-a-language
If the link is down: Search for files.associations
in the vs code settings. Then add an entry for *.xyz
to csv
.
Now the file is treated as a csv file and is recognized by the extension
Known Issues
after reordering columns or rows (e.g. sorting or manually dragged) inserting rows/col won't work (ui gets out of sync with data)
apply and save
an unnamed file will close the editor- this is because the new uri for the new file is not known and for some reason if an extension saves an unnamed file the new file is not displayed automatically
- maybe this can be resolved when https://github.com/Microsoft/vscode/issues/43768 is closed
- this is because the new uri for the new file is not known and for some reason if an extension saves an unnamed file the new file is not displayed automatically
renaming a file while an editor is open for that file will break the reference the the source file
- thus changes can no longer be saved/applied
- maybe this can be resolved when https://github.com/Microsoft/vscode/issues/43768 is closed
if the source file content changes and the file is not in the current workspace (open folder) auto file content reload is not working
- however, you are notified if the file content changes (e.g. outside of vs code)
Alternatives
Easy Csv Editor Windows
If you want to preview csv files you can go for the extension Excel Viewer. It has some more advanced sorting and filtering features.
How long will it stay in preview?
There are two things missing...
- a pretty icon ;)
- tests
- especially for interaction between vs code and the webview
- I added some listeners to handsontable hooks which manipulate rendering, selection...
Why not...?
- use merged cells for comments (rows)
- there are some problems with adding/removing rows in connection with undo & redo, sorting...
- update handsontable to 7.x.x
- with version 7 handsontable is only free for non-commercial use
Used projects
Easy Csv Editor Free
- for csv parsing/writing: papaparse
- with small custom modifications to handle comments specially
- for grid/table element: handsontable
- for ui: bulma, bulma-extension, fontawesome
- for shortcuts: mousetrap
see thirdParty
folders
There are some more in package.json
. Even if they are not referenced directly, they are used e.g. for the browser build. We copy them from node_modules
into the thirdParty
folders.
How to build locally
To compile (and watch) the files in csvEditorHtml
run
then press F5
to run the extension
When you edit csvEditorHtml/index.html
you need to manually copy the changes (everything in the body but without the scripts) into src/getHtml.ts
(past into body)
You can also open csvEditorHtml/index.html
in your favorite browser and play around (the vs code settings are not applied in the browser)
Rather immodestly we think Rons CSV Editor is the best CSV editor. However we are the ones who created it so we don't actually expect anyone to believe us. For this reason we provide an 100% free Lite version of our software, and a free trial of the Pro version, so that our customers can make up their own minds in their own time.
Our Goals
We have aimed to make the job of editing CSV files as easy as possible by keeping in mind throughout design and testing that the Rons CSV Editor is for editing data tables, and that fundamentally our product is a text editor. Our customers have also played a key role in the shaping of the product; many of the feature that are in Rons CSV Editor have been directly requested, and if a feature is missing it's probably because it has not been asked for.
Rons CSV Editor has been designed to be powerful but simple to use. In fact a large amount of effort has gone into making the user interface do what is expected, and behave in a standard way, so that our customers can find features easily and quickly.
That is not to say that we have sacrificed any power or capabilities, we have just made it easy to use.
For a list of features see the Rons CSV Editor home page .
The Competition
We would never want our customers to buy our product, without being fully aware of what the market has to offer, so here is a list of our key competitors. If you think our claim is misguided please tell us why .
Direct Competition
Name | Website | Free/Paid |
---|---|---|
CSV Easy | http://csveasy.com | Paid |
CSVEd | Free | |
Delimit | http://delimitware.com/ | Paid |
CSV Editor Pro | http://www.gammadyne.com/csv_editor_pro.htm | Paid |
Indirect Competition
Name | Website | Free/Paid |
---|---|---|
Excel | https://products.office.com/excel | Paid |
LibreOffice Calc | https://www.libreoffice.org | Free |
Google Sheet | https://gsuite.google.com/products/sheets | Free |
(See our article A Perfect Excel Alternative to handle CSV Files)
Some Differences
A feature by feature list would make a nice looking table and make Rons CSV Editor look good, but based on the fact that most features in Rons CSV Editor have directly been requested by our customers we feel comfortable that the product does what is needed. However there are some differences in approach that it might be interesting to note.
Rons CSV Editor uses the .net Framework | The reason for mentioning this is that it has some implications on memory usage at runtime, and some companies have IT policies that don't allow the use of such frameworks (although we think this factor is reduced these days). |
File Management | Some CSV editors don't load the entire file into memory to reduce memory usage and allow large files to be edited. Whilst this used to be an important factor, we feel that with most new PC's now shipping with 4GB or more, the advantages of loading the file into memory are far greater than the risk of not enough memory being available. |
Finally
If you need a professional CSV editor give Rons CSV Editor a try, and let us know what you think.