We help IT Professionals succeed at work.

Excel: Maintaining Leading Zeroes in Comma Delimited Files

Software Engineer
Software Engineer used Ask the Experts™
on
Hi:

I have read articles on retaining leading zeroes in Excel comma delimited files, using the Text Import Wizard.

But, doing so simply imports data into Excel.  If you save the resulting Excel file as a comma delimited file, you still lose the leading zeroes.

Is there not a way of retaining leading zeroes in comma delimited files in Excel?

Thanks!

John
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Qlemo"Batchelor", Developer and EE Topic Advisor
Top Expert 2015

Commented:
If columns are formatted as text instead of applying standard (automated) formatting, you should get the desired export result.
Excel & VBA Expert
Most Valuable Expert 2018
Awarded 2015
Commented:
If you are using legacy Import From Text wizard, in one of the steps, you have option to select the desired column in the preview window and change it's format to Text and the leading zeros will remain intact.

Author

Commented:
Hi All:

Yes, the Import From Text Wizard does a nice job of formatting as text.

But, saving the resulting Excel spreadsheet as a .csv file strips out the leading zeroes again.  And, if you save the resulting spreadsheet instead in .xlsx format, you no longer have a true .csv file.

John
Tom FarrarConsultant

Commented:
Try bringing the data in with Power Query (Get and Transform).  Change type to "Text", then load to table.
Qlemo"Batchelor", Developer and EE Topic Advisor
Top Expert 2015

Commented:
I really cannot see how Neeraj's comment  helps to solve your issue. You told us you managed to have leading zeros on import already. Your issue is the export, and the method I told you works fine.