Import CSV files into Excel without breaking your data
Web shops, banks and HR systems hand out data as CSV. Double-click the file and you may find everything in column A, José turned into José and the ID 00731 turned into 731. Importing it properly avoids all three.
In short: do not double-click the file. Use Data > From Text/CSV instead and set the File Origin, the Delimiter and the data type detection in the preview. Columns with leading zeros stay text.
Try it now
This is what the preview looks like when Excel reads a file with the wrong settings. Pick the settings that bring the accents and item numbers through intact.
Task The online shop exports its orders as a CSV file, saved in UTF-8 with commas between the columns. In the Data > From Text/CSV preview the accented names look broken (Zoë instead of Zoë). The item numbers have leading zeros that must stay. You want to set the Price column to a number yourself in the Power Query editor afterwards. Choose the right settings and how to continue.
| A | |
|---|---|
| 1 | Preview of the file orders.csv as it looks right now: |
| 2 | |
| 3 | Item no.,Item,Customer,Price |
| 4 | 00427,Office chair,Zoë Martin,189.00 |
| 5 | 01250,Desk lamp,José Garcia,59.90 |
| 6 | 00088,Hole punch,Renée Clarke,12.50 |
What a CSV file is
A CSV file is plain text. Each line is a record, and one character separates the fields, usually a comma or a semicolon. There are no formats, no formulas and nothing that says whether a column holds numbers, dates or text. Excel has to guess all of that when it opens the file, and that is where things go wrong.
On a double-click, Excel uses the list separator from your Windows region settings. If it does not match the character in the file, every line ends up in column A. Data > From Text/CSV lets you decide.
Import step by step
- On the Data tab, in the Get & Transform Data group, click From Text/CSV. Pick the file and click Import.
- Check the File Origin at the top of the preview. Broken accents mean it is wrong.
- Under Delimiter, pick the character between the fields. The preview shows straight away whether the columns line up.
- For data type detection, choose whether Excel looks at the first 200 rows, the entire file or does not detect types at all.
- Load puts the data straight into a new sheet. Transform Data opens the Power Query editor first, where you set columns, types and filters.
The import is saved as a query. When next week's file arrives under the same name, Data > Refresh pulls in the new rows with the same settings.
Broken accents: UTF-8 or 1252
The file origin is the character set the file was saved with. Modern systems mostly write UTF-8 (listed as 65001: Unicode (UTF-8)), older Windows programs often the Western European set 1252. When Excel reads a UTF-8 file as 1252, é becomes é and ë becomes ë. Microsoft notes that the import only infers UTF-8 when the file starts with a byte order mark (BOM). Without one, set 65001 yourself.
Leading zeros and long numbers
ZIP codes such as 02134, item numbers such as 00427 or payroll numbers lose their zeros as soon as Excel reads them as numbers. A number format such as 00000 shows the zero again, but only on screen; see format cells. The better fix is to import the column as text in the first place: turn off data type detection, or set the column type to Text in the Power Query editor.
This matters even more for long numbers. Excel keeps at most 15 significant digits and turns every digit after the 15th into a zero, which ruins a card number or a long customer ID. Always import such columns as text.
Decimal comma or decimal point
Files from Germany, France and many other countries write 12,50 where your Excel expects 12.50. If the two do not match, the amounts land in the sheet as text. The Power Query editor fixes this cleanly: right-click the column heading, select Change Type and then Using Locale. In the Change column type with locale dialog, choose Decimal Number and the locale of the file, for example German (Germany). Power Query then reads the comma as the decimal separator and loads real numbers.
If the list is already in the sheet, a formula helps. The next lesson shows how VALUE and SUBSTITUTE swap the separator.
Numbers stored as text: when VLOOKUP finds nothing
Even without separator trouble, IDs often arrive as text. They sit on the left of the cell, and Excel puts a small green triangle in the corner. To VLOOKUP, the text 4711 and the number 4711 are different values, so the lookup ends in #N/A.
Task The orders in A:B come from a CSV file. The item numbers there are stored as text (left-aligned), while the price list in F:G has real numbers. That is why =VLOOKUP(A2,$F$2:$G$6,2,FALSE) finds nothing and shows #N/A. In C2, write a formula that still finds the price, without changing the price list. It is filled down to C6.
| A | B | C | D | E | F | G | |
|---|---|---|---|---|---|---|---|
| 1 | Item no. (CSV) | Qty | Price | Item no. | Price | ||
| 2 | 4711 | 3 | 5104 | 249 | |||
| 3 | 3820 | 10 | 2290 | 12.9 | |||
| 4 | 5104 | 1 | 4711 | 89 | |||
| 5 | 2290 | 6 | 6035 | 34.5 | |||
| 6 | 4711 | 2 | 3820 | 4.75 |
This exercise is part of Premium.
Premium unlocks every exercise in every lesson, unlimited practice with fresh tasks and the final test with certificate.
See Premium Already Premium? Log in
The first exercise in this lesson is free.
VALUE turns text that looks like a number into a number. A2*1 does the same, but VALUE makes the intention clearer to whoever reads the formula next.
Text to Columns: when everything is already in column A
If the file is already open with everything in one column, select that column and use Data > Text to Columns. The Convert Text to Columns Wizard asks three things:
- Delimited or Fixed width. For CSV it is almost always Delimited.
- Which delimiters apply. Tick only the character that really sits between the fields. An extra Space splits offices such as New York or Milton Keynes.
- The Column data format: General, Text, Date or skip. Columns with leading zeros get Text. Advanced sets the decimal and thousands separators used in the file.
Task The staff data is glued together in column A: employee code, payroll number, office and department. Split it into four columns with Data > Text to Columns. Make sure Milton Keynes and New York stay one office each, and that the payroll number 00731 keeps its leading zeros. After the split, column B is the payroll number.
| A | |
|---|---|
| 1 | Export from the HR system, all in column A: |
| 2 | E-104,00731,Milton Keynes,Finance |
| 3 | E-118,02210,New York,Sales |
| 4 | E-121,00418,Leeds,IT |
| 5 | E-133,01957,San Diego,Sales |
This exercise is part of Premium.
Premium unlocks every exercise in every lesson, unlimited practice with fresh tasks and the final test with certificate.
See Premium Already Premium? Log in
The first exercise in this lesson is free.
Make sure there are enough empty columns to the right of the selected column. Otherwise the new columns land on top of the data next to it.
Common CSV import problems
Everything is in column A
The delimiter in the file does not match the list separator in your Windows settings. Pick the right delimiter in From Text/CSV, or use Text to Columns afterwards.
A date instead of a number
Values such as 1/5 or 3-4 are easily read as dates, and US and UK settings even read them as different dates. Import such columns as text and convert them on purpose afterwards.
Saving back to CSV
When you save a workbook as CSV, Excel saves only the current sheet, and features such as formulas and formatting are lost. Work in an .xlsx file and export a CSV only for the system that needs it.
In German Excel
| English | German |
|---|---|
| Data > From Text/CSV | Daten > Aus Text/CSV |
| File Origin | Dateiursprung |
| Delimiter | Trennzeichen |
| Load, Transform Data | Laden, Daten transformieren |
| Text to Columns, Convert Text to Columns Wizard | Text in Spalten, Textkonvertierungs-Assistent |
| VALUE | WERT |
German CSV files often use a semicolon as the delimiter, because the comma is the decimal separator there.
Which Excel versions support this?
Microsoft documents the From Text/CSV import for Excel for Microsoft 365, 2024, 2021, 2019 and 2016. Text to Columns and VALUE are part of every current version.
FAQ
How do I open a CSV file in Excel with the columns split?
Use Data > From Text/CSV and pick the delimiter the file uses. A double-click depends on the list separator in your Windows settings.
Why do accented letters look wrong after import?
The file is usually saved in UTF-8 and read with a different character set. Set the File Origin in the preview to 65001: Unicode (UTF-8).
How do I keep leading zeros when importing a CSV?
Import the column as text: turn off data type detection or set the type to Text in the Power Query editor. In Text to Columns, give the column the Text data format.
Can I repeat the import when a new file arrives?
Yes. The import is a query. Save the new file under the same name and Data > Refresh loads the new data.