Test files › Web and text formats › data.tsv
Sample TSV file (data)
Tab-separated values with a header row and a field that itself contains spaces.
↓ Download data.tsv| Filename | data.tsv |
| Format | TSV |
| Size | 80 bytes (80 bytes) |
| MIME type | text/tab-separated-values; charset=utf-8 |
| SHA-256 | 4f207e63c97aca7063ba37237cf4c32ced1d0fc46a2a06120e70d001eee7ed11 |
What this file catchesImporters that treat TSV as "CSV with commas" and split on the wrong delimiter, or that collapse runs of whitespace and merge the tab-separated columns.
Handle it in code
Each snippet below was run against this exact file with Python 3.14.4 and Node 24.15.0 when this page was built, and the output shown is what it printed.
Python
Sniff the dialect from a sample, then stream the rows and compare each with the header. The csv module handles quoted commas and newlines inside fields, which is exactly what a split(',') gets wrong. line_num is the physical line, so it stays right when a field spans lines.
import csv
with open("data.tsv", newline="", encoding="utf-8-sig") as f:
try:
dialect = csv.Sniffer().sniff(f.read(64 * 1024), delimiters=",;\t|")
except csv.Error:
dialect = csv.excel # the sniffer gives up on irregular files: assume commas
f.seek(0)
rows = csv.reader(f, dialect)
header = next(rows)
count, bad = 0, []
for count, row in enumerate(rows, 1):
if len(row) != len(header):
bad.append((rows.line_num, len(row)))
print(f"delimiter {dialect.delimiter!r}, {len(header)} columns, {count:,} data rows")
for line, n in bad[:5]:
print(f" line {line}: {n} field{'s' * (n != 1)}, expected {len(header)}")
if not bad:
print(" every row matches the header")Run against this file, it prints: delimiter '\t', 3 columns, 3 data rows
every row matches the header
Related guides and tools
Download & verify
curl -fsSL -o "data.tsv" "https://files.hexaqa.com/web/data.tsv"
curl -fsSL "https://files.hexaqa.com/web/data.tsv" | sha256sum
# expect: 4f207e63c97aca7063ba37237cf4c32ced1d0fc46a2a06120e70d001eee7ed11