What is a CSV File?
You’ve encountered .csv files — bank statement exports, contact lists, data downloads. They look like spreadsheets but aren’t quite. Here’s the actual story.
CSV in one sentence
CSV stands for Comma-Separated Values. It’s a plain text format where each line is a row and commas separate columns.
Example:
Name,Age,City
Alice,30,New York
Bob,25,Los Angeles
Carol,42,Chicago
That’s it. No formatting, no formulas, no styling — just data.
Why CSV exists
CSV is the lowest-common-denominator format for tabular data. Every program that handles spreadsheets, databases, or data analysis can read and write CSV:
- Excel, Google Sheets, Numbers
- Databases (MySQL, PostgreSQL, SQLite, etc.)
- Programming languages (Python, R, JavaScript)
- Statistical software (SPSS, SAS, Stata)
- Business apps (CRMs, accounting software)
When two systems need to exchange data, CSV is the universal translator.
CSV vs Excel (XLSX)
| Feature | CSV | XLSX (Excel) |
|---|---|---|
| File format | Plain text | Binary/compressed XML |
| Multiple sheets | No (one table per file) | Yes |
| Formulas | No | Yes |
| Formatting | None (colors, fonts, etc.) | Yes |
| Charts | No | Yes |
| File size | Tiny | Larger |
| Universal compatibility | Yes | Mostly (some old tools struggle) |
| Human-readable | Yes (open in any text editor) | No (binary) |
For raw data exchange: CSV. For workbooks with formulas, styling, multiple sheets: XLSX.
What’s actually in a CSV
A CSV file is plain text. Open one in Notepad or TextEdit:
Name,Age,City
Alice,30,"New York"
Bob,25,Los Angeles
Carol,42,Chicago
Notice:
- Each line is a row
- Values separated by commas
- Quotes around values containing commas (like “New York” might be “New York, NY”)
- First row is usually headers (column names)
- No formatting at all — pure data
Common gotchas
Commas in data: a value like “Smith, John” needs quoting: "Smith, John". Otherwise it becomes two values.
Quotes in data: escaped as double quotes: "She said ""hello""".
Line breaks in data: tricky. Most CSV parsers handle quoted multiline values, but some don’t.
Different delimiters: despite “comma” in the name, many CSVs use semicolons (especially in Europe where commas are decimal separators) or tabs. Sometimes called TSV (Tab-Separated Values).
Character encoding: UTF-8 is standard but legacy systems use Latin-1, Windows-1252, or others. Mojibake (garbled text) usually means wrong encoding.
BOM (Byte Order Mark): some Windows tools add a special character at the start of UTF-8 files. Most modern tools handle this; some old tools choke.
Leading zeros: opening CSV in Excel can strip leading zeros from numeric-looking codes (like ZIP codes “07050” becoming 7050). This is a famous Excel annoyance.
Opening CSV files
Excel: double-click works but auto-detection can mangle data. See How to Open CSV in Excel for the careful approach.
Google Sheets: File → Import → upload CSV → choose options.
Numbers: opens CSV; usually handles cleanly.
Text editor: any text editor shows raw CSV content. Useful for inspecting structure.
LibreOffice Calc: free Excel alternative; handles CSV well with import dialog.
Converting between CSV and Excel
CSV → XLSX: use CSV to XLSX — gives you a proper Excel file.
XLSX → CSV: use XLSX to CSV — gives you a portable text file.
Both browser-based, no upload.
Common CSV use cases
Bank statement exports: download transactions as CSV for personal accounting.
Database exports: backup or transfer data between databases.
Contact list transfers: export from one app, import to another.
Data analysis input: read CSV into Python/R/Excel for analysis.
Spreadsheet sharing across platforms: when the recipient doesn’t have Excel.
Bulk uploads: many web apps accept CSV uploads for data imports.
Reporting: scheduled exports from CRMs, analytics platforms.
Working with large CSVs
Excel handles up to ~1 million rows. For larger files:
- Use Python with pandas:
pd.read_csv("file.csv")handles GB-sized files. - Use a database: load CSV into SQLite/PostgreSQL for querying.
- Use specialized tools: CSVkit, MillerCSV (command-line tools designed for big CSVs).
For most users with small/medium CSVs: Excel or Google Sheets work fine.
Privacy considerations
CSV is plain text. Anyone with the file can read everything in it. For sensitive data:
- Don’t email CSVs of personal data without encryption
- Consider encrypted archives (password-protected ZIP)
- Strip sensitive columns before sharing
CSVs don’t have built-in encryption (unlike encrypted Excel files).
Common CSV pitfalls
Excel “improving” your data:
- Converts “12-3” into a date
- Strips leading zeros from numbers
- Changes scientific notation
- Forces date formats
The fix: import as text-formatted columns. See How to Open CSV in Excel.
Inconsistent column counts: some rows have more values than others. Parsers may handle this or fail.
Empty lines: trailing blank lines confuse some parsers.
Encoding mismatch: file is UTF-8 but tool reads as Latin-1, or vice versa.
Editing CSVs
For small edits: any text editor works (Notepad, TextEdit, VS Code).
For larger edits: a spreadsheet application (Excel, Sheets, Numbers).
For programmatic edits: Python + pandas is the standard.
TL;DR
- CSV = Comma-Separated Values, plain text format for tabular data
- Universal: every spreadsheet, database, and data tool reads/writes it
- Limitations: no formulas, no formatting, no multiple sheets, no charts
- Use cases: data exchange between systems, bulk uploads, exports for analysis
- Common gotchas: Excel mangling data, character encoding, delimiter variations
- Convert: CSV to XLSX for Excel, XLSX to CSV for portability
- For opening safely in Excel: see How to Open CSV in Excel