How to import and export the CSV files



Have you ever had to import into Excel or another Microsoft program such as Outlook a CSV file (comma separated value) that uses a separator other than the one used by your operating system? For example, in the United States CSV files are based on comma (,) while in many European countries they are based on semicolon (;).

To manually edit the whole file takes time because it is not always enough to change the commas to semicolons, or vice versa, since both symbols can be present in the file, maybe within a field enclosed in quotation marks.

Well, there is a much simpler system to handle this situation: just put on top of the CSV file a statement line that tells the program importing data which separator to use. For example

sep=;

if fields are separated by semicolons, or

sep=,

if fields are separated by commas. For example, the following CSV file was produced by the United States version of Excel

Title,Author,ISBN13,Publisher,Year Published
Le 10 regole per vivere felici con un gatto,Dario de Judicibus,9788834424315,Gruppo Editoriale Armenia,2010
Imparare XML in 6 ore,Dario de Judicibus,9788848110983,Gruppo Editoriale Armenia,2000
TCP/IP in Pillole,Dario de Judicibus,9788848114417,Tecniche Nuove,2002
Le 10 Regole per Vivere Sereni,Dario de Judicibus,9788834418031,Gruppo Editoriale Armenia,2005
Le 10 Regole dei Buoni Genitori,Dario de Judicibus,9788834415054,Gruppo Editoriale Armenia,2003
La Lama Nera,Dario de Judicibus,9788834418826,Gruppo Editoriale Armenia,2006

To import it in the Italian one, just change it in the following way:

sep=,
Title,Author,ISBN13,Publisher,Year Published
Le 10 regole per vivere felici con un gatto,Dario de Judicibus,9788834424315,Gruppo Editoriale Armenia,2010
Imparare XML in 6 ore,Dario de Judicibus,9788848110983,Gruppo Editoriale Armenia,2000
TCP/IP in Pillole,Dario de Judicibus,9788848114417,Tecniche Nuove,2002
Le 10 Regole per Vivere Sereni,Dario de Judicibus,9788834418031,Gruppo Editoriale Armenia,2005
Le 10 Regole dei Buoni Genitori,Dario de Judicibus,9788834415054,Gruppo Editoriale Armenia,2003
La Lama Nera,Dario de Judicibus,9788834418826,Gruppo Editoriale Armenia,2006

Similarly, to import the CSV files produced by the Italian version of Excel

Title;Author;ISBN13;Publisher;Year Published
Le 10 regole per vivere felici con un gatto;Dario de Judicibus;9788834424315;Gruppo Editoriale Armenia;2010
Imparare XML in 6 ore;Dario de Judicibus;9788848110983;Gruppo Editoriale Armenia;2000
TCP/IP in Pillole;Dario de Judicibus;9788848114417;Tecniche Nuove;2002
Le 10 Regole per Vivere Sereni;Dario de Judicibus;9788834418031;Gruppo Editoriale Armenia;2005
Le 10 Regole dei Buoni Genitori;Dario de Judicibus;9788834415054;Gruppo Editoriale Armenia;2003
La Lama Nera;Dario de Judicibus;9788834418826;Gruppo Editoriale Armenia;2006

in the United States version, simply modify it as follows:

sep=;
Title;Author;ISBN13;Publisher;Year Published
Le 10 regole per vivere felici con un gatto;Dario de Judicibus;9788834424315;Gruppo Editoriale Armenia;2010
Imparare XML in 6 ore;Dario de Judicibus;9788848110983;Gruppo Editoriale Armenia;2000
TCP/IP in Pillole;Dario de Judicibus;9788848114417;Tecniche Nuove;2002
Le 10 Regole per Vivere Sereni;Dario de Judicibus;9788834418031;Gruppo Editoriale Armenia;2005
Le 10 Regole dei Buoni Genitori;Dario de Judicibus;9788834415054;Gruppo Editoriale Armenia;2003
La Lama Nera;Dario de Judicibus;9788834418826;Gruppo Editoriale Armenia;2006

Please use Facebook only for brief comments.
For longer comments you should use the text area at the bottom of the page.

Facebook Comments

Leave a Reply





In compliance with the appropriate provisions of the law I state that this site is no profit, has not a predefined recurrence and is not updated according to a deadline. It may therefore not be considered an editorial product under Italian law #62 of March 7th, 2001. In addition, this site makes use of the right of citation for academic and criticism provided in Article 10 of the Berne Convention on copyright.