Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Dec 2006
    Posts
    44
    Thanks
    0
    Thanked 0 Times in 0 Posts

    CSV files with excel

    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.

  • #2
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,280
    Thanks
    4
    Thanked 83 Times in 82 Posts
    You would have to change the number format of those cells.
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #3
    New Coder
    Join Date
    Dec 2006
    Posts
    44
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Location
    Zwolle, The Netherlands
    Posts
    1,120
    Thanks
    2
    Thanked 31 Times in 31 Posts
    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
    I am the luckiest man in the world

  • #5
    New Coder
    Join Date
    Dec 2006
    Posts
    44
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Roelf View Post
    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

  • #6
    Senior Coder
    Join Date
    Jun 2002
    Location
    Zwolle, The Netherlands
    Posts
    1,120
    Thanks
    2
    Thanked 31 Times in 31 Posts
    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
    I am the luckiest man in the world

  • #7
    New Coder
    Join Date
    Dec 2006
    Posts
    44
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •