The format of CSV files is based on RFC4180, with the following specifications.
Records
Separate each record with a "CRLF" newline (operation is not guaranteed with only a "CR" or "LF" newline).
Specify a newline at the end of a file.
Separate each field within a record with a halfwidth comma ",".
Format | Record | ||
---|---|---|---|
aaa,bbb,ccc | aaa | bbb | ccc |
If several commas are entered in succession, or if a comma precedes a newline, the data following the comma is regarded as empty.
Format | Record | ||
---|---|---|---|
aaa,,ccc | aaa | ccc | |
aaa,bbb, | aaa | bbb |
You cannot specify a header.
Format | Record | ||
---|---|---|---|
field1 | field2 | field 3 | |
aaa,bbb,ccc | aaa | bbb | ccc |
Double quotation marks
Enclose fields that contain newlines, double quotation marks, or commas in double quotation marks.
Format | Record | ||
---|---|---|---|
"aaa","bb | aaa | bb | ccc |
"aaa","bb,b","ccc" | aaa | bb,b | ccc |
If a double quotation mark is used in a field enclosed with double quotation marks, the first double quotation mark is regarded as an escape character.
Format | Record | ||
---|---|---|---|
"aaa","bb""b","ccc" | aaa | bb"b | ccc |
Note
An error occurs in the following cases:
Each space, tab, or whitespace character is recognized as one character, and will cause a parameter error.
A space is entered before or after a field enclosed with double quotation marks.
"zzz ", "yyy ", " xxx " |
The number of fields differs between records.
aaa,bbb |
Fields enclosed with double quotation marks and fields not enclosed with double quotation marks are both used.
aaa,"bbb",ccc |
The double quotation escape characters are not positioned correctly.
"aaa","bb"""b","ccc" |
Double quotation marks enclose the entire field.
"aaa,bbb,ccc" |