LISTSERV Maestro 8.1-4 Help

Forward >> << Back Table Of Contents

CSV Files

The term "comma-separated values" (or "tab-separated values" or "CSV") is often used as a catch-all term for all kinds of text-based data formats where the data is formatted in a line-by-line fashion. Each line contains one data record, and a number of columns per line, where the different columns are separated by comma, a tab, or some other separator character.

LISTSERV Maestro can correctly interpret comma separated text files in various formats as long as the following rules are applied:

The last rule listed above introduces the concept of "quoted values". As described, it is necessary to quote a value if the value contains the separator (because otherwise the separator would be interpreted as the start of another value). For LISTSERV Maestro to correctly know how to deal with quoted values, it is necessary to tell LISTSERV Maestro if the comma separated file contains any quoted values or not.

If a file does not contain any quoted values, then the additional rules explained below do not apply, i.e. even if one of the usual quote characters (for example quotation marks or the apostrophe) would appear anywhere in the file, they would be interpreted by LISTSERV Maestro as just another normal character.
However, such a file can also not have any value which contains the separator. If at least one value contains the separator, then this value must be quoted, and by this the file becomes a file with quoted values again.

If a file does contain quoted values (at least one of them), then it must follow these additional rules:

Here are some examples:

Simple values, separated by comma, not quoted:

  John,Doe,Chicago,USA
  Lucy,Summers,London,GB
  Karl,Hauser,Frankfurt,D

This will be parsed as follows:

John Doe Chicago USA
Lucy Summers London GB
Karl Hauser Frankfurt D

Simple values, separated by comma, not quoted, with empty fields:

  John,,Chicago,USA
  ,Summers,London,GB
  Karl,Hauser,Frankfurt,

This will be parsed as follows:

John   Chicago USA
  Summers London GB
Karl Hauser Frankfurt  

Values of which some contain a comma, separated by comma, quoted with <">:

Using the style that quotes all values:

  "John","Doe","Chicago, Illinois","USA"
  "Lucy","Summers","London, England","GB"
  "Karl","Hauser","Frankfurt","D"

Or using the style that quotes only the values that have to be quoted:
(The only values that have to be quoted in this example are the two values containing the separator character <,>.)

  John,Doe,"Chicago, Illinois",USA
  Lucy,Summers,"London, England",GB
  Karl,Hauser,Frankfurt,D

Both will be parsed as follows:

John Doe Chicago, Illinois USA
Lucy Summers London, England GB
Karl Hauser Frankfurt D

Values of which some contain a comma, separated by comma, quoted with <">, with empty fields:

Using the style that quotes all values:

  "John","","Chicago, Illinois","USA"
  "","Summers","London, England","GB"
  "Karl","Hauser","Frankfurt",""

Or using the style that quotes only the values that have to be quoted:
(The only values that have to be quoted in this example are the two values containing the separator character <,>.)

  John,,"Chicago, Illinois",USA
  ,Summers,"London, England",GB
  Karl,Hauser,Frankfurt,

Both will be parsed as follows:

John   Chicago, Illinois USA
  Summers London, England GB
Karl Hauser Frankfurt  

Values of which some contain a comma and some the quote character, separated by comma, quoted with <">:

Using the style that quotes all values:

  "John","Doe","Chicago ""The Windy City"", Illinois","USA"
  """Little"" Lucy","Summers","London, England","GB"
  "Karl ""Big Boy""","Hauser","Frankfurt","D"

Or using the style that quotes only the values that have to be quoted:
(The values that have to be quoted in this example are the two values containing the separator character <,> and also the first value of the second row, which starts with the quote character <">. In comparison, the first value of the third row does contain the quote character too, but not as the first character. Therefore this field does not have to be quoted and the quote character is therefore also not escaped.)

  John,Doe,"Chicago ""The Windy City"", Illinois",USA
  """Little"" Lucy",Summers,"London, England",GB
  Karl "Big Boy",Hauser,Frankfurt,D

Both will be parsed as follows:

John Doe Chicago "The Windy City", Illinois USA
"Little" Lucy Summers London, England GB
Karl "Big Boy" Hauser Frankfurt D
© 2002-2017 L-Soft Sweden AB. All rights reserved.