Import Builder/Guides/Excel CSV Formatting
Excel & CSV

Why Excel Is Stripping Leading Zeros (And How to Stop It)

Learn how to stop Excel from automatically changing CSV data, including dates, leading zeros, large numbers, IDs, ZIP codes, SKUs, and other values that need to remain exactly as they appear in your CSV file.

Why does Excel change CSV data?

One of the most common CSV problems is Excel automatically changing values when you open a CSV file. Excel tries to determine what each value represents and automatically assigns a data type.

A value such as 001234 may be interpreted as a number. A value such as 01/02/2026 may be interpreted as a date. A long number may be displayed using scientific notation.

This is known as Excel auto formatting or Excel's automatic type detection. The CSV itself may contain the original text correctly — the problem occurs when Excel interprets that text.

Leading zeros disappear

001234 can become 1234 when Excel interprets the value as a number.

Dates are automatically converted

Values such as 03/04/2026 can be interpreted differently depending on regional settings.

Large numbers become scientific notation

Long numeric values may be displayed as values such as 1.23457E+11.

Data can be changed when the file is saved

If Excel has converted your values and you save the CSV again, the changed values may be written back into the file.

What is Excel auto formatting?

Excel auto formatting happens when Excel automatically interprets the contents of a cell and changes how the value is represented.

This is useful for normal spreadsheet work. If you type 1000, Excel can recognize it as a number. If you type a date, Excel can recognize it as a date. However, this behavior can be undesirable when working with CSV files containing identifiers and other structured data.

Excel may automatically interpret:

001234 → number → 1234
000045 → number → 45
01/02/2026 → date
123456789012 → scientific notation
00001 → number → 1

Important: CSV files do not contain the same spreadsheet formatting and data-type information as an Excel workbook. When Excel opens a CSV, it has to interpret the text and decide how to represent each value.

Stop Excel removing leading zeros

Leading zeros are commonly used in customer IDs, product SKUs, ZIP codes, account numbers, barcodes, and reference numbers. In a shipping label upload, a ZIP code without its zero is no longer a valid address.

Original CSV value
customer_id
001234
000567
000089

Excel may interpret these values as numbers and display:

After Excel auto formatting
customer_id
1234
567
89

Treat identifiers as text. If a value is an ID rather than a quantity, there is usually no reason for Excel to perform mathematical operations on it.

Stop Excel changing CSV dates

Dates are another major source of CSV formatting problems. Excel attempts to recognize date-like values automatically, which can cause ambiguous dates to be interpreted according to the computer's regional settings.

Potentially ambiguous date
03/04/2026

Depending on the regional convention, this could be interpreted as March 4 or April 3.

Prefer an unambiguous format

Recommended
2026-03-04
2026-04-03

For application imports, YYYY-MM-DD is generally much easier to interpret consistently than ambiguous day/month formats.

Stop Excel converting numbers to scientific notation

Excel may display long numeric values using scientific notation. For example:

Original value
123456789012
Excel display
1.23457E+11

Scientific notation does not always mean that the underlying value has immediately been destroyed. However, long identifiers should not generally be treated as numbers in the first place.

If every digit is significant — such as with a barcode, account number, transaction reference, or customer ID — store the value as text.

Method 1: Import the CSV as Text

One of the safest ways to prevent Excel auto formatting is to avoid opening the CSV by double-clicking it. Instead, import the CSV through Excel's data import workflow and specify the correct column type.

Import a CSV without letting Excel guess

  1. 1Open Excel and create a new blank workbook.
  2. 2Select the Data tab in the Excel ribbon.
  3. 3Choose From Text/CSV.
  4. 4Select the CSV file you want to import.
  5. 5Review the preview and confirm the delimiter is correct.
  6. 6Select Transform Data if you need to control the column data types.
  7. 7Select columns containing IDs, SKUs, barcodes, ZIP codes, or other values that must remain unchanged.
  8. 8Change the column data type to Text.
  9. 9Select Close & Load to load the data into Excel.

Why this works: you are telling Excel how the column should be interpreted before it converts the values.

Method 2: Format cells as Text

If you are entering or pasting values into Excel manually, format the destination cells as Text before entering the values.

Set an Excel column to Text

  1. 1Select the column or cells where you will enter the values.
  2. 2Right-click the selection and choose Format Cells.
  3. 3Select the Number tab.
  4. 4Choose Text.
  5. 5Click OK.
  6. 6Now enter or paste your identifiers.
Values should remain unchanged
001234
000567
000089

Set Text before entering the data. If Excel has already converted 001234 to 1234, changing the cell format afterwards does not automatically know that two zeros were originally present.

Method 3: Wrap CSV values in quotes

When generating CSV files, values can be represented as quoted CSV fields.

Quoted CSV
customer_id,sku
"001234","00045"
"000567","00078"
"000089","00102"

Quoting is part of standard CSV syntax and is particularly useful when generating CSV data programmatically. It also helps distinguish fields that contain characters requiring CSV escaping.

If you need to protect an identifier

Generate the CSV field with quotes around the value rather than relying on Excel to decide what the value means.

Example
customer_id,reference
"000123","REF-00045"
"000456","REF-00078"

However, quoting alone should not be treated as a universal instruction to Excel to preserve every value exactly as text. If you control the Excel import process, explicitly selecting Text for the affected column is more reliable.

Method 4: Use the ="" trick

Another Excel-specific technique is to use a formula that returns the identifier as text.

Example
="001234"
="000567"
="000089"

Excel evaluates the formula and displays:

Displayed value
001234
000567
000089

This is an Excel workaround. It is useful when working directly inside Excel, but it is not generally the preferred representation for data interchange. For CSV imports, storing identifiers as text and controlling the import type is easier to maintain.

How should you stop Excel auto formatting?

Opening an existing CSV? Use Data → From Text/CSV and set important identifier columns to Text.

Entering values manually? Format the destination cells as Text before entering the values.

Generating CSV files? Keep IDs, SKUs, barcodes, and other identifiers as strings and generate valid CSV fields. Quoting values can be useful where appropriate.

Working directly in Excel? The ="" method can be useful for forcing a value to remain text.

Excel CSV formatting best practices

Do not rely on Excel automatic formatting when working with production CSV data.
Use Data → From Text/CSV when importing CSV files containing IDs or other structured values.
Set identifier columns to Text before Excel interprets the values.
Treat customer IDs, SKUs, barcodes, ZIP codes, account numbers, and reference codes as text.
Use YYYY-MM-DD for dates when your application accepts that format.
Avoid ambiguous dates such as 01/02/2026 when the intended day and month may be unclear.
Keep long identifiers as text rather than allowing Excel to convert them into scientific notation.
Quote CSV fields when generating CSV files where appropriate.
Check a sample of the imported data before saving the CSV again.
If Excel has already changed the data, recover the original values from the source rather than trying to guess what was changed.

Prevent Excel formatting problems

Build CSV workflows that validate, transform, and protect your data before it reaches your application.

Start building free