Modernize Studio
Language: English
Get a free proposal

Microsoft Excel

CSV files that open badly in Excel: the fix

Leading zeros gone, dates instead of codes, everything in one column or odd letters: why it happens with CSV files and how to avoid it.

By Modernize StudioUpdated 5 min read

In short

  • When you open a CSV with a double-click, Excel decides on its own the type of each column and can change the data.
  • It can strip leading zeros, turn codes into dates and round numbers beyond 15 digits.
  • To lose nothing, the file has to be imported from the Data tab, choosing the delimiter, the encoding and the column types.
  • In Microsoft 365 and Excel 2024 the automatic conversions can be turned off in the Options.
  • A file saved after Excel has changed the data does not get back the original values: always work on a copy.

Why Excel changes the data

A CSV file is just text: values separated by a character, usually a comma or a semicolon. It does not say whether a column contains numbers, dates or codes. When you open it with a double-click, Microsoft explains that Excel uses the default settings to interpret each column.

According to Microsoft, at that point Excel can:

  • remove the leading zeros from codes made up only of digits, such as an item code “00123”;
  • keep only 15 digits in longer numbers and show them in scientific notation: digits after the fifteenth become zero;
  • read the digits around a letter “E” as a number in scientific notation;
  • turn combinations of letters and numbers that look like dates into dates.

If a file saved by Excel has already lost zeros or digits, the original values do not come back: start again from the CSV you were sent.

Typical problems and their cause

  • Codes without their leading zeros: the column was read as a number. It has to be imported as text.
  • Long codes whose last digits turn into zero: Excel keeps at most 15 significant digits. Codes of 16 digits or more have to be imported as text.
  • Codes turned into dates: this is the automatic conversion to dates. Turn it off or import the column as text.
  • Everything in a single column: the file uses a different delimiter from the one Excel expects, for example a semicolon instead of a comma.
  • Accented letters replaced by odd symbols: the file was saved with a different character encoding from the one used to open it.

How to import a CSV without losing anything

  1. Open a new file

    Do not double-click the CSV: open Excel with a blank workbook.

  2. Choose From Text/CSV

    On the Data tab choose From Text/CSV and select the file. A preview opens with the data split into columns.

  3. Check encoding and delimiter

    At the top you will find File Origin, that is the character encoding, and Delimiter. If the accented letters look odd, try another File Origin; if everything is in one column, choose the semicolon or the right delimiter.

  4. Keep the codes as text

    Under Data Type Detection you can choose not to detect data types: that way every column stays text and no zeros are lost. With Transform Data you can then change only the right columns to number or date.

Microsoft points out that automatic detection can get it wrong, partly because it may be based only on the first 200 rows: check the preview before loading the data.

Would you like an opinion on your case?

Send us the file: within 48 hours you receive a free written assessment, even if the answer is that a small fix is enough.

How our prices work

Turning off automatic conversions

In Excel for Microsoft 365 and Excel 2024 the four conversions can be switched off one by one. On Windows: File › Options › Data, in the Automatic Data Conversion section. On the Mac: Excel › Preferences › Edit.

They apply when you open a CSV or paste data, not to data imported with From Text/CSV, which uses the choices made in the preview. If several people open the same files, the setting has to be changed on every PC.

When you save the CSV yourself

When saving as CSV, Excel uses the separator specified in the Windows region settings. Microsoft warns that changing that setting applies to the whole computer and to all programs: before doing so, ask whoever is to receive the file which separator they expect.

If every day someone exports a CSV from one program to import it into another, the problem is not Excel but the manual step. A direct connection between the two programs, or a single web application in place of the Excel sheets, removes the risk at its root.

Frequently asked questions

Why does Excel remove the leading zeros from codes?

Because it reads the column as a number. Import the file from the Data tab keeping the column as text, or turn off the conversion in the Excel Options.

Can the digits lost in a long code be recovered?

No, if the file has already been saved by Excel: Excel keeps at most 15 digits. Start again from the original CSV and import the column as text.

Why does the whole CSV end up in a single column?

The file uses a different delimiter from the one Excel expects, often a semicolon. With From Text/CSV you can choose the right delimiter.

Is the option to turn off conversions in every version?

Microsoft lists it for Excel for Microsoft 365 and Excel 2024, on Windows and on Mac. In earlier versions there is still importing with From Text/CSV.

The accented letters come out wrong: what should be done?

Import the file with From Text/CSV and change File Origin, that is the character encoding, until the preview shows the right letters.

Sources

  1. Microsoft: automatic data conversion settings
  2. Microsoft: import or export text (.txt or .csv) files
  3. Microsoft: keeping leading zeros and large numbers
  4. Microsoft: the Power Query Text/CSV connector

Official Microsoft pages.

Related guides

Related services

All guides

Contact

We work in writing: everything stays on record, so you can show it to your accountant or your IT person.

Send us your file

  1. Make a copy of the file; test data is fine.
  2. Attach it to your message. If you would like a non-disclosure agreement first, write to us without attaching the file.
  3. Within 48 hours you will receive the free written assessment and the price of a pilot module.

We work from Italy.

Describe your project in a few lines

A small request is fine too. If anything is missing, we will ask you.

Fields marked * are required.

For example: what the workbook is used for · how many people use it · Excel version, if known · does it read from or write to other files?

Attachment(optional)

Databases, Excel files, screenshots or a specification. For larger files, include a download link in your message. We only work on copies and delete them at the end of the project, with written confirmation.

Reply within one working day. Free proposal, no obligation.

Get a free proposal