In computing, a comma-separated values (CSV) file stores information you might find in a spreadsheet, such as a table of text, numbers, and dates, in a plain text file.
Typically, the first line in a plain text file would contain header information, which are labels for table information organized vertically. Starting with the second line, each line would represent a row. Each cell in a row is separated by a comma, hence its name.
The following is a simple example of this type of file. The example has three columns (labeled 'name', 'age', and 'favorite color'), and four rows (including the header line at the top).
name,age,favorite color Alice,12,green Bob,23,purple Jane,34,blue
Text in a cell may be surrounded by quotation character ("), to note the start and end of a cell (a particular column and row location) in a table. Quotation characters in a cell value in turn can be denoted by doubling the quotation character (""). This is primarily used to signify that a particular cell contains data that may be confusing to a computer that's trying to read the file. A common example of this is when a cell contains a comma as part of it's data. Without the quotation marks, it's unclear if the comma denotes a separation between cells:
name,age Smith, Joe,45 Choi, Ceri,56 Plummer, Olive,23
or if it should be part of the cell's data:
"name","age" "Smith, Joe","45" "Choi, Ceri","56" "Plummer, Olive","23"
CSV is a way to describe table data. However, various applications may require different types of tables. Having a file in CSV format may not be enough for a file to be compatible with a particular application.
Furthermore, CSV is stored in plain text. An application may have problems reading a CSV file because of incompatibility with the plain text format, either because of the character encoding or line break format.