csv format

 
  1. There is no formal definition of the CSV format, so different applications have slightly different ideas about the look of such a file. CSV Touch tries to handle as many of those as possible, but it can be a little bit difficult finding out what the problem is if your file doesn’t seem to work.



GENERAL RULES



  1. Before showing some examples, here are a couple of general rules for acceptable files:


  2. 1. The first line should contain the column titles; they must all be different

  3. 2. Use quotation marks (“) around a whole text entry if there are quotation marks inside the text entry itself (explaining example below)

  4. 3. Use quotation marks around a whole entry if the entry contains the delimiter (e.g. a comma) for the file

  5. 4. No line breaks are accepted, even if the line break is inside quotation marks

  6. 5. All rows should contain the same number of items

  7. 6. Max 64 columns and 65536 characters in one single row; no row limit except for the global memory limitation for an application (how many rows this means in real life depends on how long they are; normally thousands of lines is not a problem)


  8. Almost all applications which can export CSV files will automatically produce files fulfilling these rules, so it is rare that you need to know about them.


  9. NOTE: There is a setting for “Alternative Parsing” in the preferences for CSV Touch. If this is set to ON, files will be parsed (i.e. investigated for entries, line breaks etc.) in another way which is normally more lenient in the files accepted. This means that Rule 2 and 4 above no longer applies; if you have line breaks between quotation marks, this is OK; if you have quotation marks only inside a text entry itself, this is OK. However, this alternative parsing behaves slightly different in other situations as well, for example being slower, so try which one is better for your files.


GOOD FILEs


  1.     "Author","Title",Price,"Copies","Part of...",Number,Category,Created

  2.     "Abbott,E","Flatland",100,1,,,Novel,02/12/1991

  3.     "Abell,E","Exploration of the Universe, 2nd Ed.",175,1,,,Physics,02/12/1991

  4. Note that it is OK to have quotation marks around some entries, but not around others (“Author” compared to Physics). However, it is necessary to use them for “Abbot,E” since there is a “,” inside the text entry (Rule 3 above).



  5.     Title;Plattform;Price;Bought

  6.     Advance Wars;GBA;125;15/11/2002

  7.     Advance Wars: Dual Strike;DS;328;

  8. Note that it is not necessary to have quotation marks here since there are no “;” inside the text entries. Also note the trailing “;” in the last row which is necessary to indicate that the data in the last column (“Bought”) is empty for this row (Rule 5 above).


BAD FILEs


  1.     Title,Length,Language

  2.     Three Amigos,99,English

  3.     Lindsay Anderson's "if...",129,English

  4. The problem here is the last row which uses quotation marks inside the text entry in the first column (Rule 2). The correct row to make sure that the text entry appears with quotation marks around the word if...:

  5.     "Lindsay Anderson's ""if...""",129,English

  6. (There is a setting, “Keep Quotes”, which would make this example work OK, but for almost all files using “Keep Quotes” will lead to errors.)


    "Austen,J",Emma,"2007"

    "Austen,J","Pride and Prejudice",2006,19th century

Here there are 2 problems. The first is the fact there are no column titles, i.e. an initial row with those is missing (Rule 1 above):

    Author,Novel,Year,Notes

The second problem is in the “Emma” row. There are no notes for this novel, but to indicate this the row needs a terminating “,” to make all the rows have the same number of items (Rule 5):

    "Austen,J",Emma,"2007",


    Actor/Actress|Line|Movie

    "Groucho Marx"|"Either he's dead, or my watch has stopped."|"A Day at the Races"

    "Clark Gable"|"Frankly, my dear,

     I don't give a damn!"|"Gone With the Wind"

Here the problem is the line break inside Clark Gable’s line; it is inside quotation marks but this is still illegal (Rule 4). Correct version:

    "Clark Gable"|"Frankly, my dear, I don't give a damn!"|"Gone With the Wind"