Closed PPCM closed 6 years ago
Hello @PPCM , what do you mean by excel doesn't parse a CSV?
I created a CSV file (comma separated values) saved with the name test.csv
, then opened it with Excel. It all looked fine, as in, different fields appeared in the different columns as expected.
Hi @PPCM , I'm closing this for now as I'm not getting the more information. Feel free to reopen it if you have more things to add :wink:
Sorry for the long time In my case, Excel 2016 open the file with each line in a simple cell, even if I use the import feature
I have the same question: can I use tab delimiters? In my case I'm writing data that is coming from a tsv and has commas and quotes in the data.
Hi @Sigfried . At the moment, no, csv-writer produces only CSV.
Do you actually want to produce TSV, or are you ok with CSV as long as commas/quotes in the data are properly handled? csv-writer should be able to produce a properly formatted CSV file by automatically escaping comma/quote characters (like this).
I didn't know Excel assumes semicolon as a field delimiter in some regions. Given that Excel is widely used software to consumer CSV, I'm going to support this variance even though it's not RFC4180 compliant. Thanks @PPCM & @Sigfried for flagging the issue!
From https://github.com/ryu1kn/csv-writer/pull/8#issuecomment-414106442
Ok, I found that, on Windows, depending on the "Regional and Language Options" settings, Excel assumes different characters for the field delimiter...
- How to open semicolon delimited CSV-files in US-version of Excel - StackExchange
- CSV with comma or semicolon? - StackOverflow
Seems we do need to support
;
as a delimiter. Now I need to find what is the escaping rule for the field value when;
is used as a separator.
Also from Wikipedia
Adjacent fields must be separated by a single comma. However, "CSV" formats vary greatly in this choice of separator character. In particular, in locales where the comma is used as a decimal separator, semicolon, TAB, or other characters are used instead.
Changed List separator from ,
to ;
and Excel used ;
for field separator when I saved data into a CSV file. Fields containing ,
are not wrapped with double-quotes, but fields containing ;
are now wrapped instead.
Merged PR #8 , thanks @HKskn !!
Published as v1.1.0. Now semicolon is also treated as a valid field separator. I'll create a separate card for TSV.
Is it possible to change the delimiter to
;
for example ? Excel doesn't parse a CSV with comma as delimiter