Back to Guide
.csv
Comma-Separated Values
A Comma-Separated Values (CSV) file is a delimited text file that uses a comma to separate values. Each line of the file is a data record. Each record consists of one or more fields, separated by commas.
Advertisement
History & Origin
CSV predates personal computers by more than a decade. The IBM Fortran compiler supported them under OS/360 in 1967. It was finally formally documented in RFC 4180 in 2005.
Internal Structure
Data is stored as plain text. Each row in the file represents a row in the table, and columns are separated by a delimiter (usually a comma, but sometimes semicolons or tabs). Special characters within values often require escaping or quoting.
Advantages
- Simplicity: Extremely easy to generate and parse.
- Universal support: Can be opened by Excel, Numbers, Google Sheets, and text editors.
- Compact: Very little overhead compared to XML or JSON for tabular data.
Disadvantages
- Flat structure: Cannot represent nested or hierarchical data easily.
- Data types: No distinction between strings, numbers, or dates (everything is text).
- Encoding issues: Can suffer from character encoding problems (e.g., UTF-8 vs ASCII).
Common Use Cases
Importing and exporting data between spreadsheets and databases
Data analysis and data science
Contact lists
E-commerce product catalogs
Advertisement
