CSV File Format Explained

Comma-Separated Values · .csv

Extension.csv
MIME typetext/csv
TypeSpreadsheets and data
Developed byIETF (RFC 4180)
First released1972
Royalty-freeYes
CompressionNone

What is a CSV file?

A CSV file is a plain-text table: one line per row, fields separated by a delimiter, usually a comma. Fields that contain the delimiter, quotes or line breaks are wrapped in double quotes. There are no sheets, formulas, styles or data types: every value is text until the reading program interprets it.

The format is described in RFC 4180 but implementations vary: European locales often use a semicolon because the comma is the decimal separator, and files may be encoded in UTF-8, Windows-1252 or another code page. Those two details cause most CSV import problems.

When CSV is the right choice

Strengths

  • Universally readable: spreadsheets, databases, scripts and text editors
  • Small and simple; easy to generate and to diff in version control
  • The standard exchange format for imports and exports in web services

Limitations

  • No formatting, formulas, multiple sheets or column types
  • Delimiter and character encoding are not stored in the file
  • Leading zeros and long numbers are mangled when opened carelessly in Excel

How to open a CSV file

Any text editor shows the raw rows. For a table view, open the file in Excel, LibreOffice Calc, Google Sheets or Numbers; use the import dialog rather than a double-click when the delimiter is a semicolon or the text is not UTF-8, so that columns and accented characters come out right.

How to convert to or from CSV

Tables locked in a PDF report come out as data with PDF to CSV; when you want formulas and formatting around them, PDF to Excel is the better target. For tables printed in a scan or a screenshot, Image to Excel recognizes the cells first.

Frequently Asked Questions

Why does Excel put all my data in one column?

Excel guessed the wrong delimiter, usually because the file uses semicolons while the system locale expects commas. Use Data → From Text/CSV and pick the delimiter, or open the file in LibreOffice which asks first.

How do I keep leading zeros in a CSV?

CSV keeps them; the spreadsheet drops them when it converts the text to a number. Import the column as text, or quote the values and prefix them with an equals sign and quotes when generating the file for Excel.

What encoding should a CSV use?

UTF-8 is the safe default today. Older versions of Excel expect a byte-order mark to detect UTF-8, so files without it may show accented characters wrongly; LibreOffice and Google Sheets handle both.

Can a CSV file have multiple sheets?

No. A CSV file is exactly one table. Workbooks with several sheets export to several CSV files or to XLSX.

How do I open a CSV that is too big for Excel?

An Excel worksheet holds at most 1,048,576 rows, and Excel warns that the rest of the file was not loaded. You can load the file through Data, From Text/CSV and send it to the Data Model instead of a sheet, which avoids the row limit for analysis. Alternatives are a database such as SQLite, a script in Python or R, or command-line tools. Splitting the file into smaller parts also works.

What is the difference between CSV and TSV?

Both are plain-text tables with one row per line. CSV separates fields with a comma, or with a semicolon in some locales. TSV separates them with a tab character. Since tabs rarely appear inside real data, TSV seldom needs quoting, which makes it easier to parse with simple tools. Commas, on the other hand, appear often in names, addresses and numbers. Spreadsheets open both formats, though you may have to choose the delimiter when importing.