+ Reply to Thread
Results 1 to 4 of 4

Reading Numbers as Strings from .csv file

  1. #1
    Registered User
    Join Date
    01-07-2010
    Location
    Alexandria, VA
    MS-Off Ver
    Excel 2010
    Posts
    5

    Reading Numbers as Strings from .csv file

    I have a .csv file that contains numerical data in the form of strings, much of which starts with leading zeros (i.e. "012345"). I double checked to make sure the .csv file has the leading zeros and that they are wrapped in quotation marks in notepad, and it does. However, when Excel opens the file, it must read those strings as numbers, becuase it chops off the zeros. Does anyone know of way to fix this? Can Excel read numbers as strings straight from a .csv file?
    Last edited by andrewlong; 01-08-2010 at 12:25 PM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Reading Numbers as Strings from .csv file

    You'd have to save as .txt file instead, and then when you open that file, you have to go through the wizard, in the 3rd window select the column with numbers that you want to keep as text.. and select Text for the column data format area...
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Contributor
    Join Date
    01-18-2005
    Location
    Auckland New Zealand
    MS-Off Ver
    Office Professional 2007
    Posts
    295

    Re: Reading Numbers as Strings from .csv file

    When Excel opens a csv file it processes it automatically, and displays numbers using a general format.

    If you want to bring these fields in with leading zeros, you could change the file to a txt file (by changing the suffix), and then open it with Excel. This will bring up the text file wizard, which has options to treat the field as text. This will retain leading zeroes.

    (Just pipped by the above!)

  4. #4
    Registered User
    Join Date
    01-07-2010
    Location
    Alexandria, VA
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Reading Numbers as Strings from .csv file

    thanks for the help guys, it worked. However, I have to say that I also tried to open it in OpenOffice, and gives you that option without changing it to a text file first. I can't believe Microsoft is laggin behind a free piece of software.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1