CSV
Stands for "Comma-Separated Values." CSV is a standard way to store structured data in a plain text format. It is a common export option in desktop applications and some websites. Most spreadsheet programs can import data from a .CSV file.
A list of comma-separated values represents a table. Each line in a CSV file is a row and the value between each comma is a column. The first row is often a table header containing labels for each column. Since the data in a CSV file represents a table, each line should have the same number of comma-separated values.
CSV Format
Since CSV files use the comma character "," to separate columns, values that contain commas must be handled as a special case. These fields are wrapped within double quotation marks. The first double quote signifies the beginning of the column data, and the last double quote marks the end. If the value contains a string with double quotes, these are replaced by two double quotes, or "".
Below are some standard CSV formatting rules:
- Table data is represented using only plain text.
- The first line may or may not represent the table header.
- Rows are separted by line breaks (newline characters).
- Columns (fields) are separated by commas.
- All lines contain the same number of values.
- Fields that contain commas must begin and end with double quotes.
- Fields that contain line breaks must begin and end with double quotes (not all programs support values with line breaks).
- All other fields do not require double quotes.
- Double quotes within values are represented by two contiguous double quotes.
Example CSV Data
The following three lines represent a table with three rows and four columns, starting with a table header.
ID,Website,URL,Description
1,TechTerms,https://techterms.com,"TechTerms, the Computer Dictionary"
2,Slangit,https://slangit.com,"Slangit, the ""Clean Slang"" Dictionary"
The data above may be displayed in a table like this:
ID | Website | URL | Description |
1 | TechTerms | https://techterms.com | TechTerms, the Computer Dictionary |
2 | Slangit | https://slangit.com | Slangit, the "Clean Slang" Dictionary |
Using CSV Files
A *.csv file can be opened, viewed, and edited in any text editor. However, because of the minimalistic nature of the CSV format, the data is often difficult to read. Therefore, it is best to view CSV files in a spreadsheet program like Microsoft Excel or Apple Numbers. These applications parse the comma-delimited data and display the values as a table within a spreadsheet.
File extension: .CSV