vscode_rainbow_csv icon indicating copy to clipboard operation
vscode_rainbow_csv copied to clipboard

Feature suggestion: Use "sep=" hint if present

Open anthroid opened this issue 4 years ago • 2 comments

Excel will automatically interpret a CSV with a header line in the format sep=; if present. This would allow a file to specify its delimiter, and also avoid the need to manually set the header line (and possibly the delimiter/language setting) for each file that is opened. This isn't part of RFC 4180, but it is a commonly used convention, especially with Excel, and is easily parsed if present.

See this note from Affinity for reference: How to open CSV files with the correct delimiter/separator

Alternately, if this line can't be used to set the delimiter, it would still be helpful if the extension could skip it automatically if present and use the following line as the header row, otherwise you get a WARN: inconsistent num of fields until you set the header row manually.

Examples with sep= header:

sep=;
One;Two;Three;Four
1;2;3;4
5;6;7;8
sep=|
One|Two|Three|Four
1|2|3|4
5|6|7|8

anthroid avatar Mar 20 '22 19:03 anthroid

The current workaround would be to set sep= as a "comment prefix" just for this file, select it with cursor -> right click -> set as comment prefix.

mechatroner avatar Sep 10 '22 03:09 mechatroner