Data Import & Export

Preserve Leading Zeros in ZIP Codes When Importing CSV Files in Excel

Huma Ashraf ChHuma Ashraf Ch Nov 18, 2026 870 views

Question details

Import a CSV file into Excel without losing leading zeros in ZIP codes.

How to Preserve Leading Zeros in ZIP Codes When Importing CSV Files in Excel
Product
Microsoft Excel
Device & OS
not provided
Scenario
A CSV file contains ZIP codes that need to remain intact when imported into a spreadsheet.
Observed behavior
Opening the CSV directly causes Excel to interpret ZIP codes as numbers and remove leading zeros.
Before you start

Locate the original CSV file and identify the ZIP code column. Check whether the codes are all five digits or include other formats, such as ZIP+4, before choosing a method.

Solution 1Recommended

Import the ZIP Code Column as Text with Power Query

Use this method to preserve ZIP codes before Excel converts them to numbers.

1
Start the import

In Excel, select Data > Get Data > From File > From Text/CSV, choose the original CSV file, and select Import.

2
Avoid automatic type detection

In the import preview, choose Do not detect data types if that option is available, then select Transform Data.

3
Set the ZIP column to text

In Power Query, check Applied Steps and remove an automatic Changed Type step if it converted the ZIP codes. Select the ZIP code column, then choose Data Type > Text.

4
Load the data

Select Home > Close & Load and check that ZIP codes with leading zeros appear as expected.

Import the ZIP Code Column as Text with Power Query
Use the original CSV: Changing a column to Text after its zeros have already been removed does not restore them. Reimport from the original CSV when possible.
Work with CSV files in WPS

Preserve ZIP Codes When Importing CSV Files in WPS Spreadsheets

Use the text import options in WPS Spreadsheets to identify the ZIP code column as text before loading the CSV data.

  1. 1. Open the CSV file: In WPS Spreadsheets, choose Menu > Open and select the original CSV file.
  2. 2. Set the delimiter: In the text import dialog, select the delimited option and choose Comma.
  3. 3. Set ZIP codes to text: Select the ZIP code column in the preview and set its column format to Text before completing the import.
  4. 4. Check and save the data: Finish the import, verify the leading zeros, and use Save As to save the spreadsheet in your preferred format.
Preserve leading zeros in ZIP codes by importing the column as textOpen and work with Microsoft Excel XLSX and XLS filesUse a familiar spreadsheet interfaceWork with CSV data in a free, lightweight office suite
microsoft office alternative - wps office

Frequently Asked Questions

Why does Excel remove zeros from ZIP codes in a CSV file?

When you open a CSV directly, Excel may interpret ZIP codes as numbers. Numbers do not retain leading zeros, so import the ZIP column as Text instead.

Can I restore a zero by changing the column format to Text?

No. Changing the format after conversion does not recover a removed zero. Reimport the original CSV as text, or use =TEXT(A2,"00000") if the codes should all be five digits.

How do I prevent Power Query from converting ZIP codes automatically?

In the From Text/CSV preview, select Do not detect data types if available. In Transform Data, remove any automatic Changed Type step that converted the ZIP column, then set that column's data type to Text.

Will the five-digit TEXT formula work for ZIP+4 codes?

No. The formula =TEXT(A2,"00000") is intended for five-digit codes and cannot reconstruct a missing hyphen or other lost characters. Import ZIP+4 values as text from the original CSV.