Leading zeros disappear in a product import? Fix it
Keep product IDs such as 000731 intact by checking the CSV and importing the ID column as text before software changes it to a number.
You import a product list, then find codes like 000731 have become 731. That can break matching, barcodes, or product listings, even though the digits seem to be the same. The problem is usually automatic number conversion, not a change to the product itself.
Check whether the zeros are still in the original CSV, then make the importing software treat the product-code column as text. The CSV Editor can help you inspect and edit the file before you import it.
Check the product IDs before importing
- Open the file in the CSV Editor. Find a product code that lost zeros, and check whether the original file still shows them.
- Check the column heading and a few examples. Confirm that the values are product identifiers, not quantities or prices. For example,
000731may be an ID even if it contains only digits. - Note the expected code format. If codes must all have six digits, record that rule. Do not add zeros based on a guess about the required length.
- Import the file using an option that sets the product-code column to Text or String. If the importer offers a preview or column mapping, check the IDs there before completing the import.
If the zeros are missing from the original CSV, the importer cannot know which ones were there. Restore those values from a trusted product catalog or backup before importing. For more on preparing zero-padded identifiers, see how to preserve leading zero IDs in a CSV.
What the result means
The zeros appear in the CSV but disappear after import
The source file is intact, and the receiving software is converting the column to numbers. Reimport the file and set that column to text before loading the records. If the import screen has no type setting, look for a product-code field format or a setting to preserve source values.
The zeros are already missing in the CSV
The change happened before this import, often when someone opened and resaved the file in a spreadsheet. Recover the correct IDs from the system that created the catalog, a backup, or another authoritative list. Avoid padding every value unless you know the required code length and have checked that all IDs follow the same rule.
Long IDs appear in scientific notation or have changed digits
The software probably treated the IDs as numbers. Some spreadsheet programs also round long numbers, so changing the display format later may not restore the original digits. Return to an unmodified source file and import the column as text from the start.
How to fix the import
- Set the product-code column to text during import. In Excel on Windows 11, go to Data › From Text/CSV, choose the file, then select Transform Data. Select the product-code column and change its data type to Text before loading. In recent Excel versions on macOS, use Data › Get Data (Power Query) › Text/CSV, then set the code column to Text in the query before loading. Menu names can vary by Excel version.
- Check the import preview. Look at several IDs, including one with leading zeros and one with many digits. The preview should show the exact values from the CSV, not shortened numbers or scientific notation.
- Check the destination field type. If your catalog system has a field type for product codes, choose a text or string field. A numeric field may strip zeros even when the CSV is correct.
- Test with a small sample first. Import a few products into a test file, draft, or staging area if available. Confirm that the IDs remain exact before importing the full catalog.
- Verify the saved records. After the import, open a few products in the destination system and compare their IDs with the original CSV. Do not rely only on a formatted spreadsheet view, which can hide how values were stored.
Why adding quotes may not fix it
A CSV can put a value in quotes, such as "000731", to handle commas, quotation marks, or other special characters within a field. But CSV files do not reliably tell every program that a field is text. An importer may still convert a quoted value to a number, so setting the column type in the import process is more dependable.
Likewise, changing a spreadsheet column to a text format after the zeros have disappeared does not restore them. The original digits must still be available, or you need a trusted source to rebuild the identifier.
Keep a clean source copy
Before editing or importing, keep an unchanged copy of the supplier's original CSV. If you need to make corrections, use the CSV Editor to inspect or edit the data, and check the corrected values before using the file. Files opened in the browser stay on your device.
