janisdd / vscode-edit-csv

vs code extension to edit csv files with an excel like table ui
MIT License
227 stars 35 forks source link

Option to allways wrap values in " or other char #169

Closed RHasemann closed 2 weeks ago

RHasemann commented 1 month ago

Edit cvs 0.10.0

Feature

Please add the option (in Write options?) that field values could always be surrounded with a char, like " or ' for example and don't remove these on empty fields. Because this makes a big difference! If you, for example, use the csv to import data into a database:

... ,, ... means the value is null, whereas ... ,"", ... means the value is an empty string!

Which is a big difference if your db has non-null columns!

Thx!

janisdd commented 1 month ago

Hm, never thought about that. With the text quote all fields, one would assume that all fields would be quoted (empty or not). So I think it would be good to put empty fields in quotes as well.

However, since this changes the current functionality and some users probably want to keep the old behavior, it would be good to add an option.

Essentially: new option Quote empty fields (bool) with default value true

janisdd commented 2 weeks ago

Hmmmm ... it turns out that I already implemented an option for this ... quoteEmptyOrNullFields with the default value false.

As mentioned in the description of this option, it takes precedence over the Quote all fields option.