What is CSV?
How CSV Structures Data
CSV (Comma-Separated Values) is the simplest way to store tabular data, a table of rows and columns, in a plain text file. The rule is exactly what the name says: each line of the file is one record (a row), and the fields within a record (the columns) are separated by commas. An optional first line, the header, names the columns. That is essentially the entire format: rows on lines, columns split by commas. A spreadsheet of names and emails becomes a few lines of name,email text.
This radical simplicity is CSV's superpower. Because it is plain text with an obvious structure, virtually every program that handles data can read and write it: spreadsheets like Excel and Google Sheets, databases, programming languages, analytics tools, and countless web services. CSV is the universal lingua franca for moving data between systems that otherwise share no common format, which is exactly why it remains everywhere despite being decades old.
The format does have to handle a few edge cases. A field that itself contains a comma, a line break, or a quote would break the simple split-on-commas rule, so such fields are wrapped in double quotes, and quotes inside them are doubled. This quoting convention is the one piece of real complexity in CSV, and it is where most CSV bugs come from when a program parses naively by splitting on every comma.
CSV vs a Spreadsheet (XLSX)
It is important to understand what CSV is not. A CSV holds only the data, the raw values in rows and columns. It does not store formatting, fonts, colors, multiple sheets, formulas, charts, or cell types; it is just text. An XLSX (Excel) file, by contrast, is a rich spreadsheet that stores all of those things. So when you save an Excel workbook as CSV, you keep the values of a single sheet and lose everything else, formulas become their computed values, formatting and extra sheets disappear.
This is by design, not a flaw. CSV's job is to be a clean, portable carrier of pure data that any system can import, while XLSX's job is to be a full working spreadsheet. You use CSV to move data between tools and XLSX to work with data in a spreadsheet. Converting between them is routine: export to CSV to feed another system, import a CSV into Excel to analyze it.
When to Use CSV
Reach for CSV whenever you need to exchange tabular data between different programs: exporting records from a database or web app, importing a contact or product list, feeding data into an analytics or programming tool, or storing simple datasets in a future-proof, universally-readable form. It is the right choice any time the data matters and the formatting does not. When you need formatting, formulas, or multiple sheets, use XLSX instead.
Limitations and Quirks
CSV's simplicity brings real quirks. There is no single official standard, so files vary: some use semicolons instead of commas (common in regions where the comma is a decimal separator), line endings differ across systems, and character encoding (ideally UTF-8) must be agreed on or text can garble. It stores no data types, so everything is text, leading numbers can lose their leading zeros, long numbers can turn into scientific notation, and dates can be misread when a CSV is opened in Excel. And it holds only one table with no formatting or formulas. These are the price of being the simplest, most universal data format, and they are why careful import settings matter when working with CSV.
CSV vs Other Spreadsheet & Data Formats
| Feature | CSV | XLSX | JSON |
|---|---|---|---|
| Structure/type | Delimited text[1] | Zipped XML | Nested text |
| Formatting/formulas | None[3] | Yes | None |
| Data shape | Flat table | Multi-sheet | Hierarchical |
| Standardized by | IETF (RFC 4180)[2] | ECMA / ISO | ECMA / IETF |
| App support | Universal | Broad | Broad |
| Best for | Tabular interchange | Rich spreadsheets | Structured data |
CSV is a simple flat-table interchange format, while XLSX adds formatting and formulas and JSON handles nested data.
Advantages & Disadvantages
Advantages
Universal Compatibility | FileFormer, Every spreadsheet app, database, and programming language can read and write CSV without special libraries.
Human Readable | FileFormer, CSV is plain text - you can open and edit it in any text editor and immediately understand the data.
Tiny File Size | FileFormer, No formatting, no metadata - CSV files are extremely compact compared to XLSX or database exports.
Easy to Generate | FileFormer, Any application or script can produce valid CSV with a simple loop, making it ideal for data exports.
Disadvantages
No Data Types | FileFormer, Everything is stored as text - dates, numbers, and booleans must be interpreted by the receiving application.
No Formatting | FileFormer, CSV stores only raw data - no bold text, colors, merged cells, or any visual formatting.
Encoding Issues | FileFormer, Special characters and non-ASCII text often cause problems when files are opened in different locales.
No Relationships | FileFormer, CSV cannot represent relational data or multiple tables - you need multiple files or a different format.
Common Use Cases
Here are the most common scenarios where CSV is the right choice:
Database Exports | FileFormer
Exporting database tables to CSV for backup, analysis, or migration to another system.
Data Analysis | FileFormer
Input format for Python pandas, R, Excel, and virtually every data analysis tool.
CRM and Marketing Data | FileFormer
Contact lists, email subscriber exports, and sales data shared between marketing tools.
Application Integration | FileFormer
Moving data between applications that do not share a native integration or API.
Frequently Asked Questions
What is the difference between CSV and Excel?
CSV is plain text with just data. Excel (XLSX) includes formatting, formulas, multiple sheets, and charts. CSV is for data portability; XLSX is for spreadsheet work.
Why does my CSV look wrong in Excel?
Usually an encoding issue (UTF-8 vs ANSI) or delimiter mismatch. Use Data > From Text/CSV import in Excel to specify encoding.
Can CSV have commas in the data?
Yes - values containing commas must be wrapped in double quotes. Most CSV parsers handle this automatically.
What encoding should I use for CSV?
UTF-8 with BOM is safest for international characters and Excel compatibility. Pure UTF-8 works best for programming use.
Is TSV better than CSV?
TSV (tab-separated) avoids comma conflicts in data but is less universally supported. For most use cases, CSV is the safer choice.