How to check a CSV file before importing it
By the MyDataFixer team · Updated
The short answer
Before importing a CSV into an online shop, a CRM, an email tool or a database, check five things: every row has the same number of values, the column names are present and unique, quotes are closed, the separator is the one the program expects, and the file is saved as UTF-8. A free validator can check all of this in seconds.
Why imports fail
Import tools are strict. A person can understand a slightly messy file, but a program stops at the first line it can't read, or worse, imports data into the wrong columns without warning. A few minutes of checking saves hours of fixing wrong records afterwards.
The most common problems
- Rows with too many or too few values. Usually a comma inside a value that wasn't put in quotes, like an address “Shop 4, Main Street”.
- Broken quotes. A quotation mark that opens but never closes makes the program read the rest of the file as one value.
- Missing or duplicate column names. An empty header, or two columns both called “email”.
- The wrong separator. The program expects commas, but the file uses semicolons.
- The wrong encoding. Names with accents or non-English letters turn into strange characters.
- Blank lines and hidden characters that create empty records or break a line in the middle.
- Values that start with =, +, - or @. Spreadsheet programs may treat them as formulas when the file is opened.
Example
id,name,city,email
1001,Asha Patil,Lyon,asha@example.com
1002,Ravi Kumar,Shop 4, Main Street,ravi@example.comLine 3 has five values instead of four, because of the comma in “Shop 4, Main Street”. Written correctly, the address is in quotes: "Shop 4, Main Street". An import tool would either reject this line or put “Main Street” in the email column.
A simple checklist
| Check | What to look for |
|---|---|
| Column names | First line has every name, none empty, none repeated |
| Same number of values | Every row has as many values as there are column names |
| Quotes | Values with commas or line breaks are in quotes, and every quote closes |
| Separator | Comma, semicolon or tab: whatever the program asks for |
| Encoding | UTF-8 (with or without BOM, as the program needs) |
| Required columns | Names match the program's template exactly |
How to check by hand
- Open the file in a plain text editor (Notepad on Windows, TextEdit on Mac, or any text editor app on a phone).
- Look at the first line: are the column names right?
- Look at a few lines in the middle and at the end: do they look like the first data line?
- Search for quotation marks and check they come in pairs.
- Compare the column names with the import template of the program you're using.
This works for small files. For files with thousands of lines, a validator is much faster and doesn't miss anything.
Check it in Excel or Google Sheets
Opening the CSV in Excel or Google Sheets shows rows that spill into an extra column, which is a good sign of a missing quote or an extra comma. Sort by the last column to bring those rows to the top. But be careful: spreadsheets also change values (dates, leading zeros), so don't save the CSV from there unless you have to.
Check it with MyDataFixer
Open the file in the CSV Validator. It runs nine checks: text encoding, separator, the number of values in every row, column names, quotes, line endings and blank lines, hidden characters, Excel and Google Sheets limits, and extra separators at the end of lines. It then says clearly whether the file is valid and whether it will import cleanly.
Each problem shows the exact line as written in the file, with its line number. Safe repairs are offered with a preview: fix column names, remove blank lines, remove hidden characters, remove empty extra fields, add an apostrophe before values that look like formulas, and more. Problems that can't be fixed safely, like a row with real extra data, are explained so you can correct them by tapping the cells.
Then download the file with the separator, line endings and encoding the program needs. It is checked again before the download. Your file stays on your device.
How to avoid import problems next time
- Start from the import template the program provides, and keep its column names.
- Export with a tool that puts quotes around values with commas (Excel and Google Sheets do this).
- Test with a small file of five rows before importing thousands.
From start to finish: an example
Anita wants to import 2,000 products into her online shop. The first try fails with “row 341: unexpected number of columns”. She opens the file in the CSV Validator, which shows line 341 exactly: a product name with a comma that isn't in quotes. It also finds two columns both called “price” and three blank lines at the end. She fixes the column names and removes the blank lines with the offered repairs, corrects line 341 by hand, and downloads the file with commas and UTF-8 without BOM, as the shop asks. The second import works.
Quick summary
Most failed imports come from uneven rows, broken quotes, bad column names, the wrong separator or the wrong encoding. Check these by hand for small files, or run the CSV Validator, repair, and download in the format the program expects.
Fix it in your browser
Free, no sign-up. Your file is processed on your device and never uploaded.
Questions and answers
What makes a CSV file invalid?
Rows with a different number of values, quotes that never close, unreadable characters, hidden control characters, and empty or duplicate column names.
Why does my import say 'unexpected number of columns'?
At least one row has more or fewer values than the header, usually because of a comma inside a value without quotes.
Should I use commas or semicolons?
Whatever the program you import into asks for. Most online tools expect commas.
Can I check a file without a header row?
Yes. In the CSV Validator, untick “First row contains column names”, and column names are not checked.
Does MyDataFixer upload my file?
No. The file is checked in your browser, on your device.