|Filename extension||.csv, .txt +|
|Internet media type||text/csv|
|Type|| Tabular data|
spreadsheet file format
|Opens with||Any text editor|
|File formats category -|
A comma-separated values file stores tables in data form. Each line is a row in the table, and cells in each row are separated by commas.
There are many variations of the CSV format.
- Each line is separated with a line break. A line break at the end of the file is optional.
- Cells in each row are delimited by a comma.
- Depending on the implementation, for each cell, leading and trailing spaces are trimmed. For example, in the RFC 4180, spaces are not trimmed and are considered part of the cell.
- If a cell contains a comma, the whole cell must be enclosed in double quotes:
spam,2:40,"Hormyl Music Co., Ltd.",rock
|spam||2:40||Hormyl Music Co., Ltd.|
If we didn't place quotes, it would look like:
|spam||2:40||Hormyl Music Co.||Ltd.|
- The same goes for a line break within the cell:
spam,2:40,"It's really good
I can feel it"
|spam||2:40|| It's really good|
I can feel it
- The same goes for a quotation mark within the cell. The quotation mark is replaced by two quotation marks.
|spam||It's "really" good|
- Depending on the implementation, the same goes for leading and trailing spaces:
spam," Hoooormyyl "
- RFC 4180, format for MIME type "text/csv" format
- Fielded text
- How To: The Comma Separated Value (CSV) File Format