How to fix CSV import errors
Questi contenuti non sono ancora disponibili nella tua lingua.
CSV looks simple, which is exactly why imports break. Below are the failures that account for most “my CSV won’t import” problems — what causes each, and how to fix it.
1. Wrong delimiter (commas vs semicolons)
Section titled “1. Wrong delimiter (commas vs semicolons)”In many locales, Excel exports CSVs with semicolons, not commas, because the comma is the decimal separator. An importer expecting commas then sees one giant column.
Fix: detect or specify the delimiter explicitly. If you control the export, save as comma-delimited UTF-8; if you don’t, use an importer that sniffs the delimiter.
2. Encoding mismatch and mojibake
Section titled “2. Encoding mismatch and mojibake”Café arriving as Café means the file was written in one encoding and read in another. Legacy
exports are often Windows-1252; modern tools expect UTF-8.
Fix: standardize on UTF-8. Watch the BOM — some tools require the byte-order mark, others choke on it. Tell the importer the encoding instead of letting it guess.
3. Stripped leading zeros
Section titled “3. Stripped leading zeros”07401 becomes 7401. Excel auto-types the column as a number and drops the zero — painful for
ZIP codes, phone numbers and external IDs.
Fix: treat those columns as text. Don’t double-click the CSV into Excel and re-save; keep the raw file and import it with a tool that preserves string columns.
4. Mangled dates
Section titled “4. Mangled dates”03/04/2026 is March 4 or April 3 depending on locale, and spreadsheets love to “helpfully”
reformat dates on open.
Fix: use ISO 8601 (2026-03-04) end to end, and map date columns to a typed date field so
parsing is explicit rather than guessed.
5. Unescaped quotes, commas and line breaks inside fields
Section titled “5. Unescaped quotes, commas and line breaks inside fields”A field containing Smith, John or a newline breaks naive row parsing, shifting every column
after it.
Fix: follow RFC 4180 — wrap fields in double quotes and escape embedded quotes by doubling
them (""). Use a real CSV parser, never a split(',').
6. Header mismatch
Section titled “6. Header mismatch”The file says E-mail Address; your importer expects email. Strict importers reject it; loose
ones silently drop the column.
Fix: map headers to fields explicitly. A good importer matches headers to your schema and shows you the mapping before anything is committed, instead of failing on an exact-string miss.
7. Large files: timeouts and memory
Section titled “7. Large files: timeouts and memory”Files fail at size when the importer reads everything into memory or runs inside one HTTP request that times out.
Fix: stream or chunk the file and process it server-side. Raise upload limits deliberately, and prefer a pipeline designed for large files over a single in-browser pass.
8. Trailing whitespace and hidden characters
Section titled “8. Trailing whitespace and hidden characters”Invisible spaces, tabs and zero-width characters make "active " ≠ "active", breaking lookups
and dedupe.
Fix: trim and normalize on import, and validate values against expected types so anomalies surface before they reach your database.
The pattern behind all of these
Section titled “The pattern behind all of these”Every fix above is the same move: stop trusting the file, and validate + map it explicitly before it touches your system. Doing that by hand per file is fine once. Doing it for every customer’s file, forever, is what a real import pipeline is for — deterministic header matching, typed validation, encoding handling and a fix-it-then-submit step, so bad rows are caught instead of silently corrupting your data.
Why is my CSV not importing correctly? Usually a wrong delimiter, an encoding mismatch (mojibake), stripped leading zeros, reformatted dates, unescaped quotes/commas inside fields, or header names that don’t match expected columns.
How do I fix garbled characters after a CSV import? Standardize on UTF-8, handle the BOM deliberately, and tell the importer the encoding instead of letting it assume a legacy code page.
Why does Excel remove leading zeros from my CSV? Excel auto-types the column as numeric. Import the column as text, or keep the raw file and use a tool that preserves string columns.
Why does my CSV import fail on large files? The importer loads the whole file into memory or times out. Stream or chunk it and process it server-side.
Building import for other people’s files and tired of fixing these one by one? That’s what Mildport’s deterministic matching and typed validation handle by default — see how it works or try it at mildport.com.