What Is a Flat File? CSV, TSV, and Delimited Data Explained
Flat files defined simply: rows and columns in plain text, how they differ from spreadsheets and databases, when to use CSV vs TSV vs fixed-width.
A flat file stores data as plain text with no structure beyond rows and columns — no formulas, no types, no relationships. CSV is the most famous example, but the family includes TSV (tab-separated), pipe-delimited, and ancient fixed-width formats still used by mainframes.
What "flat" actually means
Everything is flattened into two dimensions. Where a spreadsheet cell can hold =B2*1.2, a flat file holds only the result: 24. Where a database links orders to customers through foreign keys, a flat export repeats the customer's name on every order row. This repetition looks wasteful; it is the price of universal readability.
Flat file vs spreadsheet
| Aspect | XLSX | CSV |
|---|---|---|
| Formulas | Live calculations | Values only |
| Types | Dates, currency, text | Everything is text |
| One workbook | Multiple sheets | One table |
| Opens anywhere | Needs Excel-compatible app | Any editor on Earth |
The type-less nature causes the classic damages — Excel eating leading zeros or turning IDs into scientific notation (why it happens) — because a flat file never says "this column is an ID," only 00127.
CSV vs TSV vs other delimiters
Same idea, different separator character:
- Comma — the default everywhere; breaks when data contains commas (solved by quoting rules).
- Tab — common in bioinformatics and log exports; survives commas naturally.
- Pipe — beloved in legacy enterprise pipelines.
Switching between them is mechanical: Change CSV Delimiter converts any variant to any other, and CSV Diagnostic detects which one an unknown file uses.
When flat files are the right tool
Handoffs between systems that will never agree on software. Datasets small enough to email but too big for copy-paste. Archives meant to outlive the application that made them. For everything larger or more relational, databases win — and our import CSV to database guide covers that crossing.
The limits you eventually hit
Flat files earn their simplicity by giving things up, and knowing which losses matter prevents painful migrations:
- No concurrency: two writers to one CSV corrupt it. Databases solve this with locking; flat files solve it by hoping.
- No integrity rules: nothing stops
balance: -999999or a duplicate primary key. Validation moves outside the file — into tools like Validate CSV and the profiling workflow in how to clean CSV data. - No partial reads with structure: you can stream rows, but "give me orders joined to customers" means reading everything twice and matching in memory.
A brief practical history
Flat files predate databases by decades — batch systems in the 1960s shipped magnetic tapes of fixed-length records between programs. Delimited text won because humans could read tapes' successors directly; RFC 4180 (2005) merely documented what everyone already did. TSV survives in bioinformatics where fields are gene names that never contain tabs; pipe-delimited persists wherever mainframe job output feeds modern pipelines unchanged.
Converting in either direction
The common crossings, all browser-side:
- Into analysis: prepare CSV for Pandas covers header hygiene and type inference before
read_csv. - Into storage: CSV to SQLite generates schema plus inserts in one pass.
- Out of spreadsheets: Excel to CSV flattens workbooks back down when a downstream tool rejects XLSX.
- Between delimiters: Change CSV Delimiter converts comma/tab/pipe variants without opening a text editor.
The takeaway
Flat files trade structure for universality. Use them as the lingua franca between systems, not as the system itself — and validate at every border crossing, because plain text trusts everyone and verifies no one.
Related Articles
CSV Line Endings: CRLF vs LF (and Why Imports Complain)
Windows CRLF, Unix LF, and old Mac CR line endings explained — how mixed endings break row counts, and how to normalize a CSV before importing.
Looking for a CSVJSON Alternative? A Privacy-First Option
Comparing CSVJSON-style converter tools with HappyCSV: privacy, file size limits, batch processing, and which tool fits JSON-to-CSV, CSV-to-JSON, and SQL workflows.
Fixed-Width vs CSV: What Fixed-Column Files Are and How to Convert
Fixed-width files explained: columns defined by character positions instead of delimiters, where they still appear, and how to convert them to CSV safely.
Continue with HappyCSV
Choose a focused browser-based tool for the next step in your workflow.