The 7 Most Common CSV Problems

If you've ever imported a CSV into a database, opened one in a spreadsheet, or tried to join two CSVs together, you've hit these problems. They're universal. Here's the full list with the fix for each:

ProblemWhat it looks likeWhy it happens
1. Duplicate rowsSame record appears 2+ timesExport from multiple sources, appending without dedup
2. Trailing/leading whitespace"New York " doesn't match "New York"Human data entry, Excel formatting
3. BOM characterFirst column name has invisible  prefixSaved as "UTF-8 with BOM" from Excel on Windows
4. Encoding mismatchJosé becomes José or Jos?Latin-1 saved as UTF-8, or vice versa
5. Inconsistent nullsEmpty field written as NULL, N/A, --, "", or blankMultiple people, systems, or exports contributing data
6. Comma/quote inside fieldsRow splits in wrong place, fields mergeUnescaped commas in text fields like addresses
7. Mixed date formats01/02/2026 — Jan 2 or Feb 1?US vs EU date formats in the same column

Removing Duplicate Rows — The Right Way

Not all "duplicates" are actually duplicates. There are three levels:

1. Exact duplicates (all columns match)

These are safe to delete. The row is literally identical. Use the Remove Duplicates tool — it compares entire rows, keeps the first occurrence, deletes the rest.

2. Key-based duplicates (one column matches)

Two rows have the same email or ID but different other fields. This is trickier — you need to decide which row to keep. Maybe the one with the most recent timestamp? The most complete set of fields? Key-based dedup requires merge logic, not just deletion.

3. Fuzzy duplicates (similar but not identical)

"John Smith" vs "John Smyth" vs "Jon Smith". Same person, slightly different spelling. Fuzzy matching (Levenshtein distance, Soundex) helps, but automated fuzzy dedup is risky. Review manually or set a high similarity threshold (>95%).

💡 Rule of thumb: Start with exact duplicates. They're the easiest win, and they usually account for 80% of your duplicate problem. Then manually review key-based dupes. Leave fuzzy matching for last.

Invisible Whitespace That Breaks Joins

This is the most frustrating CSV problem because you can't see it. Your VLOOKUP returns #N/A. Your SQL JOIN returns zero matches. The values look identical. They're not.

Common whitespace issues:

  • Leading spaces: " New York" — space before the value. Happens when data entry people hit spacebar before typing.
  • Trailing spaces: "New York " — space after. Even harder to spot.
  • Non-breaking spaces:   — looks like a space, isn't a space. Common in web-scraped data. Regular trim() won't remove it.
  • Tabs instead of commas: File looks CSV but delimiter is actually tab. TSV masquerading as CSV.

Our CSV Cleaner automatically trims whitespace from every field. For non-breaking spaces, it normalizes all Unicode whitespace characters to standard spaces first, then trims. If you're cleaning in code, use .replace(/\s+/g, ' ').trim() — the \s class catches non-breaking spaces too.

Encoding Hell: UTF-8, BOM, and Garbled Text

CSV encoding problems come from one fact: CSV has no built-in way to declare its character encoding. A CSV file is just bytes. The reader guesses. When the guess is wrong, you get garbled text.

The BOM Problem

Windows Excel writes CSVs as "UTF-8 with BOM" by default. BOM (Byte Order Mark) = three invisible bytes (EF BB BF) at the start of the file. Most non-Microsoft tools don't expect these bytes. Result: the first column header gets a  prefix.

// BOM corruption example
Expected header: "id","name","email"
Actual header:  "id","name","email"

// SQL query fails: column "id" not found
// JSON key becomes "id" instead of "id"
// VLOOKUP can't match "id" because it's actually "id"

The fix: strip the BOM. Our CSV Cleaner does this automatically. In code: check if the first three bytes are 0xEF, 0xBB, 0xBF — if so, remove them before parsing.

UTF-8 vs Latin-1

If accented characters (é, ñ, ü) appear as two garbled characters like é, your file is UTF-8 being interpreted as Latin-1 (ISO-8859-1). If they appear as ?, your file is Latin-1 being interpreted as ASCII. The fix: explicitly set encoding when opening, or convert the file with a tool.

The Fastest Workflow for Cleaning Any CSV

  1. Open the CSV in a text editor first (not Excel). Check the raw data. Are fields quoted? What delimiter? Any obvious garbage in the first few rows?
  2. Remove duplicate rows — use Remove Duplicates for exact dedup.
  3. Clean whitespace and nulls — use CSV Cleaner to trim all fields, standardize empty values.
  4. Convert if neededCSV to JSON or JSON to CSV if you're switching formats.
  5. Validate — count rows before and after each step. If a cleaning operation changed the row count, investigate. It shouldn't (except dedup).
⚠️ Never open a production CSV in Excel first. Excel "helpfully" auto-formats dates, strips leading zeros from IDs (000123 → 123), converts long numbers to scientific notation (123456789012345 → 1.23457E+14), and saves as UTF-8 with BOM. Opening and re-saving a CSV in Excel can silently corrupt data. Always work on a copy.