View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Pete_UK Pete_UK is offline
external usenet poster
 
Posts: 8,856
Default Leading Zeros in .CSV files

Rename the .csv file so that it has an extension .txt, then with Excel
running you do File | Open (select "All files *.*" in the File Type
panel) and select your file. Excel will automatically enter the data
import wizard, where in the third stage you can specify that you want a
particular field to be imported as a text field - this will preserve
any leading zeros.

If you do this a lot you can record a simple macro once and then run
this whenever you need to import the file again.

Hope this helps.

Pete

klafert wrote:
I have done this before but drawing a blank. I have a clolumn with "001" and
it is in a file sales.csv. I format the coumn the file in this manner:
Format = Style - Custom - and put in 3 zeros. It then displays the leading
zeros. But when I open the file it goes away. Then when I tried to import
the files and I get errors because the 001 doesnt matchl. However, If I do
the format and save then it will import. But this is a file that I import a
lot. I get the file from one program and have to open it to format it and
resave before I can import. I done this before and I thought there was an
options I had to set in Excel also. Any help?