Zayko in the Net

Personal blog of Vitaly Zayko


How to specify what separator you use in CSV file?

CSV (Comma-separated values) files are very handy for using in self-generated tabular reports as they extremely easy to create in any programming language. But to be opened correctly in Microsoft Excel, the separator should depend on Windows Regional settings: in some countries it could be comma whereas in others – semicolon etc. Fortunately there is an easy way how to let Excel know what separator you use in a given file. Just put sep=<separator symbol> as the very first string in your file (get rid of <>  chars, just put a symbol). It could any symbol that is not used in your data guaranteed, even invisibles such as TAB (ASCII 9).

Add comment