CSV errors guide
Causes and fixes for common CSV errors. Check your data before import.
Last updated: 2026-03-30
Introduction
When importing CSV into a database or integrating with other systems, errors often come from encoding issues, duplicate IDs, or invisible characters. This guide explains the main types and how to fix them using the CSV Checker.
Quick checklist: why imports fail
Use this checklist when a CSV “looks fine” but import still fails. Start from top and you can usually pinpoint the root cause in minutes.
- Wrong delimiter: Your system expects commas, but the file uses tabs/semicolons (or vice versa).
- Encoding mismatch: Excel saved in a regional encoding; the importer expects UTF-8 (or the opposite).
- BOM / header issues: UTF-8 BOM, duplicate headers, or header row included again inside data.
- Column count drift: Some rows have extra/missing separators (unescaped commas in text, broken quotes).
- Line endings: Mixed CRLF/LF can break strict parsers.
- Invisible characters: Zero-width spaces, non‑breaking spaces, tabs, or stray control characters.
- Leading/trailing spaces: “ID” and “ID ” become different keys; trimming fixes many merge issues.
- Duplicate IDs: Primary/unique key column contains duplicate values.
- Quoted fields: Unclosed quotes or inconsistent quoting rules cause parse errors.
- Data types: Dates/decimals formatted unexpectedly (locale-specific), causing validation failures.
Fast path: run Inspect first (encoding/delimiter/columns/BOM), then Check (duplicates/invisible chars/trim). For garbled text, use encoding recovery.
Real-world examples: find root cause in 10 minutes
Case A. Text is readable in browser but garbled in Excel
Symptom: Preview looks fine, but Excel shows broken characters.
Cause: Source file is UTF-8 without BOM, and Excel opens it with a local code page.
Fix: Convert with encoding recovery and download as UTF-8 with BOM.
Case B. DB import fails with duplicate key
Symptom: Import step returns a duplicate key error.
Cause: Duplicate IDs plus trailing spaces in key values.
Fix: Use single-file check to detect duplicates, trim spaces, then re-import.
Case C. Same-looking values do not match
Symptom: Join/search mismatch even though values look identical.
Cause: Zero-width spaces or non-breaking spaces in text.
Fix: Remove invisible characters in one click, then verify again in compare view.
1. Garbled text (wrong encoding)
Cause
Opening a file with the wrong encoding (e.g. UTF-8 vs Windows-1252) produces garbled text. Excel often saves CSV in a regional encoding unless you choose “CSV UTF-8”.
Fix
- Detect the correct encoding and convert to UTF-8 (with BOM if you need Excel to open it).
- The encoding fix tool detects encoding in the browser and lets you download UTF-8 BOM. No upload to server.
See Encoding issues for details.
2. Duplicate IDs
Cause
If the column used as primary or unique key (ID, email, etc.) has the same value in multiple rows, you get DB constraint errors or wrong merges.
Fix
- Check for duplicates in the key column before import.
- Single-file check reports “duplicate ID” and lists affected rows so you can fix or decide to allow duplicates.
See Duplicate data guide.
3. Invisible characters
Cause
Data copied from other apps or the web can contain zero-width spaces, tabs, or odd line endings that break matching and search.
Fix
The single-file check detects “invisible characters” and can fix them in one click. Trimming leading/trailing spaces is also available.
4. Column count mismatch and empty lines
Rows with a different number of columns (missing or extra commas) can make parsers or import tools fail. Format check shows how many rows have mismatched columns and empty lines so you can fix the source or skip them on import.
5. Duplicate headers
If a data row is identical to the header, column meaning becomes ambiguous. The format check reports duplicate header rows so you can remove or correct them.
Workflow with CSV Checker
- Format check (inspect): Upload one CSV; see encoding, delimiter, row/column counts, empty lines, header duplicates.
- Single-file check (check): Detect invisible chars, duplicate IDs, trim spaces; apply fixes and download.
- For garbled files, use encoding fix (encoding-fix) first to get UTF-8 BOM, then run the checks above.
Tools you can use now
- Format & basic check — delimiter, columns, encoding, BOM
- Single-file check — duplicate IDs, invisible characters, trim
- Encoding recovery — convert to UTF-8 BOM for Excel
- Compare two files — diff two CSVs before or after fixes