Clean a CSV Without Losing Leading Zeros

Open a CSV in a spreadsheet and ZIP code 02134 becomes 2134, and a 19-digit account number turns into 1.23E+18. This example cleans a fictional customer file while keeping every digit.

โ„น๏ธ A worked example you can check. The before and after tables below were produced by the free tool on this site from a fictional sample file. Open the same file yourself and you will get the same result.

What Usually Goes Wrong

โ€ข ZIP codes that start with zero
โ€ข Customer IDs padded with zeros
โ€ข Account numbers longer than 15 digits
โ€ข Phone numbers that lose their + sign
โ€ข The usual stray spaces and repeated rows on top

The Sample File, Before

7 rows of fictional data with the problems above. Every person and company is invented.

Open This File in the Workspace Download the CSV

Clean a CSV Without Losing Leading Zeros sample before cleaning
Customer IDNameZIPPhoneAccount Number
000481Halima Yusuf02134(617) 555-018100012345678901234567
000482Peter Vandermeer00501631.555.01821234567890123456789
000483  Ingrid Solberg 07030+1 201 555 018300098765432109876543
000482Peter Vandermeer00501631.555.01821234567890123456789
000484Mateo Ferrer96701808-555-01844000000000000000002
000485Chiara Benedetti06510(203) 555 018500000000000000000017

How to Clean It

1. Do not open and re-save the CSV in a spreadsheet first. Load the original file straight into the workspace.
2. Run it with duplicates and phones switched on.
3. On the Review step, check that the ZIP, Customer ID and Account Number columns show no highlighted cells.
4. Export as CSV for a CRM import. If people will open the result in Excel, use the Excel export: every cell is stored as text, so the zeros, long numbers and + signs are still there when the file opens.
5. If the file was already damaged by a spreadsheet, go back to the system it came from and export again. Lost digits cannot be recovered from the damaged copy.

Prefer the command line or an AI agent? The same result comes from smartdata-clean clean leading-zeros.csv --dedupe-rows --phones. See tools for agents.

The Result

7 rows in, 2 removed, 5 out. The repeat and the blank row are removed, the padded name is trimmed and phones are standardized. Every ZIP, ID and account number is identical to the original, character for character โ€” the verifier compares all of them.

Clean a CSV Without Losing Leading Zeros sample after cleaning
Customer IDNameZIPPhoneAccount Number
000481Halima Yusuf02134+1617555018100012345678901234567
000482Peter Vandermeer00501+163155501821234567890123456789
000483Ingrid Solberg07030+1201555018300098765432109876543
000484Mateo Ferrer96701+180855501844000000000000000002
000485Chiara Benedetti06510+1203555018500000000000000000017

What the tool left for you

Nothing was listed for review on this file.

Checked, not just claimed

The original file, the cleaned file and the change log were run through the separate verifier. Result: PASS.

โœ“ Removed rows with a valid, verified reason: 2 of 2
โœ“ Rows: 7 in, 2 removed with a logged reason, 5 out
โœ“ Cells compared: 25; changed: 6; every change matched to the log: yes
โœ“ Log entries: 9; not matching the files: 0

The verifier confirms that the change log explains every difference between the two files. It does not judge whether each cleaning choice suits your situation; that part is yours.

The cleaning report

Where a Tool Stops and a Person Starts

If the only copy you have has already lost its zeros, a person can sometimes rebuild them from a known length or a second source, and will tell you which values could not be recovered. Ask for a quote under Complex Cleanup.

See Service Levels From $19 How We Check Our Work

When the tool reads an Excel file, it warns you if it finds numbers longer than 15 digits, because Excel may already have rounded them before the file was saved.