Comma-separated values

Filename extension .csv, .txt +
Internet media type text/csv
Type Tabular data
spreadsheet file format
Standard RFC 4180
Opens with Any text editor
File formats category - v  e   edit
Smallwikipedialogo.png Wikipedia has an article related to:

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.



spam 2:40 rock
eggs 1:32 jazz
noodles 4:52 hiphop
  • 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"

spam It's "really" good
  • Depending on the implementation, the same goes for leading and trailing spaces:

spam,"  Hoooormyyl  "

spam   Hoooormyyl  

External linksEdit

Community content is available under CC-BY-SA unless otherwise noted.