Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSV with comma or semicolon?

Tags:

csv

How is a CSV file built in general? With commas or semicolons? Any advice on which one to use?

like image 604
membersound Avatar asked Apr 13 '12 12:04

membersound


People also ask

Does CSV use comma or semicolon?

In North America and some other countries, the default list separator is a comma, so you get CSV comma delimited. In European countries, a comma is reserved for the decimal symbol, and the list separator is generally set to semicolon.

Can you use semicolon in CSV?

Depending on your Excel's regional setting, your default delimiter/separator may either be using semicolons (;) or commas (,) to separate items in a CSV file.

Should a CSV file end with a comma?

CSV is a Comma Seperated File. Generally the delimiter is a comma, but I have seen many other characters used as delimiters.

What is the correct format for a CSV file?

CSV , or Comma-separated Values, is an extremely common flat-file format that uses commas as a delimiter between values. Anyone familiar with spreadsheet programs has very likely encountered CSV files before - they're easily consumed by Google Spreadsheet, Microsoft Excel, and countless other applications.


1 Answers

In Windows it is dependent on the "Regional and Language Options" customize screen where you find a List separator. This is the char Windows applications expect to be the CSV separator.

Of course this only has effect in Windows applications, for example Excel will not automatically split data into columns if the file is not using the above mentioned separator. All applications that use Windows regional settings will have this behavior.

If you are writing a program for Windows that will require importing the CSV in other applications and you know that the list separator set for your target machines is ,, then go for it, otherwise I prefer ; since it causes less problems with decimal points, digit grouping and does not appear in much text.

like image 122
Sibster Avatar answered Sep 25 '22 02:09

Sibster