...

View Full Version : CSV files with excel



uxair
07-05-2007, 06:46 AM
I've a csv file with following records

"0012345","1","05 june 07","09 June 07"
"0012345","2","05 june 07","09 June 07"
"0012345","3","06 june 07","10 June 07"
(when opened with notepad)

but when I open it with excel, excel hides the leading zeroes and show them as follows:

12345 1 5-Jun-07 9-Jun-07
12345 2 5-Jun-07 9-Jun-07
12345 3 6-Jun-07 10-Jun-07

so my question is how could I tell excel to not to hide leading zeroes form numbers.

Spookster
07-05-2007, 08:37 AM
You would have to change the number format of those cells.

uxair
07-05-2007, 09:02 AM
and how would I do that

NOTE: I google it and found a way to show leading zeroes by setting cell number format to custom and type *0.
this infact doesn't solve even the part of the problem. first it appends * zeros to the cell, while I needed only thos e ones which r stored(refer my first post) secondly, I need to set something like like global settings for excel coz there could be more than 100 file generated by the process.

Roelf
07-05-2007, 10:34 AM
when you import the data in excel, you have the opportunity to set the format type for each of the columns you want to import. Set that to "text" and everything shows up as it was in the csv file

uxair
07-05-2007, 10:45 AM
when you import the data in excel, you have the opportunity to set the format type for each of the columns you want to import. Set that to "text" and everything shows up as it was in the csv file

actually I'm importing this data from xml files programitcally

Roelf
07-05-2007, 11:12 AM
you didn't say that

are you importing from xml through vba in excel?

next time you want to ask a question, ask the question you want answered, describe the situation and ask the correct question. Otherwise we are spending time and effort to answer the wrong question:mad:

uxair
07-06-2007, 06:37 AM
well, the fact that I didn't mention how the csv files are generated, coz it has nothing to do with the actual problem, and actually it was your assumption that I was importing data from excel's import functionality. It is pretty clearly stated in the first post of thread that numbers are imported in the correct format(the on I want) which is proved by opening this in notepad, but it is excel's intelligence that omit the leading zeroes from the numbers i.e: if u write 0012 in a cell of excel sheet, excel will detect it as an integer and will omit the leading zeroes and will covert it to 12, so I suppose there would be something like global setting that would prevent excel from doing this.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum