# CSV

> A plain text file that holds a table: one row per line, commas between values.

- Level: Basic
- Topics: Data
- URL: https://tidbit.legios.com.ar/csv/
- In Spanish: [CSV](https://tidbit.legios.com.ar/es/csv/)

A **CSV** file (comma-separated values) is the simplest way to write a table down. Each line is a row, and inside a line the values are separated by commas; the first line usually holds the column names. Because it is plain text, any program can read it: a spreadsheet, a database, a script, even a text editor.

A small one looks like this: `name,city,age` on the first line, then `Ana,Rosario,34` and `Luis,Salta,29`. When a value contains a comma itself, it goes between double quotes (`"Buenos Aires, AR"`). There is no single official version, so details vary: many spreadsheets set up for Spanish use semicolons, because there the comma is the decimal separator, and accents come out garbled when the file was not saved as UTF-8.

CSV is the universal export button: banks, CRMs, open-data portals and analytics tools all offer it, and it is often the first step when moving data from one system to another. Its weakness is that it has no types: the file does not say whether `03/04` is a date, a fraction or text, so every program has to guess. For large analytics datasets, formats like Parquet are much smaller and faster to read.

## An analogy

A shopping list written one item per line, with the quantity after a comma. Anyone can read it and anyone can write it, but nothing stops someone from writing 'a few' where a number should go.

## Keep in mind

- One row per line, values separated by commas, column names on the first line.
- Plain text: every spreadsheet, database and programming language can open it.
- It has no types, so dates and numbers are open to interpretation.
- Separators and encodings vary; if accents look broken, check that it is UTF-8.

## Go deeper

- [Comma-separated values on Wikipedia](https://en.wikipedia.org/wiki/Comma-separated_values)
- [RFC 4180, the common CSV format](https://www.rfc-editor.org/rfc/rfc4180)

## Related terms

- [Spreadsheet vs database](https://tidbit.legios.com.ar/spreadsheet-vs-database/): Why a company that runs on Excel eventually needs a real database.
- [Database](https://tidbit.legios.com.ar/database/): An organized store of data that programs can search and update safely.
- [Unicode](https://tidbit.legios.com.ar/unicode/): The universal numbering of every letter and symbol, and why accents sometimes break.
- [Parquet](https://tidbit.legios.com.ar/parquet/): A file format that stores tables by column, compressed, so analytics reads far less.
- [Programming language](https://tidbit.legios.com.ar/programming-language/): A precise, written language people use to give instructions to a computer.
