converting

C

csmith

I have placed leading zero in my excel doc and try to save as CSV file it
drops my leading zero even when I put the leading zero back into the CSV file
it will not save. Any suggestions?
 
A

Ag

If you format that cell as text instead of number it will not drop
leading 0

Regards
Anirudh
 
D

David Biddulph

I think you are confused. If you have a leading zero and you save as CSV,
then I would be pretty confident that the leading zero will still be there
in your CSV. I would suggest that you open your newly-saved CSV with
Notepad to check.
The problem arises if you try to read your CSV with Excel, either by
double-clicking in the CSV or by File/ Open. Going through that route,
Excel will decide that the incoming text is a number, and automatically
remove the leading zeroes. If you want to keep the leading zeroes you need
to treat the incoming number as text, which the text import wizard allows
you to do. To impose the text import wizard, either rename your .csv as
..txt before trying to open it, or open the CSV from within Excel by using
Data/ Import External Data.
 
D

Dave Peterson

Don't reopen the .csv file in excel. That's what's losing the leading zeros.

Use Notepad to verify that your .csv file is correct.
 
L

Leslie W.

I have had this same problem in the past.

Data > Get External Data > From Text

Then you can pull in your .CSV file. It will walk you through on how you
want your text to be imported (how it understands columns, either delimited
or Fixed Width). After that, you can tell it how to interpret the data type
of the column. Change that to "Text." Then, it will import as text and keep
the leading zeroes.

I haven't had good luck with changing the column type to text in Excel, that
was the only way I was able to pull it off.

Good luck.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top