csv

From iMacros
Revision as of 12:08, 7 April 2011 by Td (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The CSV ("Comma Separated Values") file format is often used to exchange data between differently similar applications. The CSV file format is useable by iMacros, Microsoft Excel and many other applications.

The CSV Format:

1. Each record is one line - Line separator may be LF (0x0A) or CRLF (0x0D0A), a line seperator may also be embedded in the data (making a record more than one line but still acceptable).

2. Fields are separated with commas.

3. Leading and trailing whitespace is ignored - Unless the field is delimited with double-quotes in that case the whitespace is preserved.

4. Embedded commas - Field must be delimited with double-quotes. A single cell with the text apples, carrots, and oranges becomes "apples, carrots, and oranges".

5. Embedded double-quotes - In fields containing a double quote, the double quote must be escaped by replacing the single double quote with two double quotes.

6. Embedded line-breaks - Fields must be surrounded by double-quotes.

7. Always Delimiting - Fields may always be delimited with double quotes, the delimiters will be parsed and discarded by the reading applications.

Here are some examples that demonstrate the rules above. Each sample describes the data and how the reading application should interpret it.

Standard lines:

 AAA, BBB, CCC 
 111, 222, 333
 444, 555, 888

Leading and trailing whitespace and embedded commas:

 "  AAA ", "B,B,B", "   CCC,,," 

Double-quotes: If your input data is
He said "Great!" and "with quotes" and no quotes
the corresponding line in the CSV input file looks like:

 "He said ""Great!""", """with quotes""", "no quotes" 


Note: In the USA and some other countries, for example the United Kingdom, Windows uses a dot (.) as decimal delimiter. For example, 0.5 = 1/2. In these countries, the data entries in a CSV file are separated by commas (,).

In continental Europe and some countries elsewhere Windows uses a comma (,) as decimal delimiter. For example, 0,5 = 1/2. In these countries, the data entries in a CSV file are separated by semi-colons ( ; ).

You can switch between ; and , by going to Start > Control Panel > Regional and Language Options > Standards and formats drop down. You can change the country there. For ; as CSV separator select (for example) USA and for , as separator select (for Example) Germany.


You can also configure iMacros to use the regional settings of your system when reading and writing CSV files.

Note: You must restart iMacros after changing this setting for it to take effect.

Use regional settings in CSV files.png


Related forum posts:

Wiki articles: