Re: convert number to text without losing zeroes



Just check that the leadings zeros are not actually missing from
the .csv file by opening it in Notepad - you should be able to see the
format of the file more clearly there. If the part numbers are stored
in Excel as numbers and just formatted to have a leading zero, then
they will be missing from the csv file - a formula like:

=TEXT(A1,"000000")

will convert them to text values. You could fix these values then copy
them back over the offending cells.

If you are bringing the file into Excel then rename it by changing
the .csv extension to .txt. Then with Excel running do File | Open,
point to the .txt file and then Excel will take you into the Data
Import Wizard, where you have more control over how the fields are
treated.

Hope this helps.

Pete

On Sep 25, 11:22 pm, DaveK <Da...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
I cannot find an answer to this problem anywhere, perhaps someone here can
help.
I have 2 columns of data that I pulled from my proprietary database using
ODBC. The first column is part numbers, and the second is a list price for
the part. The part numbers are a mix of numbers, letters, and some dashes.
I am saving this list to a .csv, uploading it to my web server, and then
logging in to my webserver and importing the data from the .csv to a mysql
database.
The problem is coming in when I have part numbers that start with zero. An
example would be 010888. The zero gets dropped off when I save it as a .csv.
I figured I could convert it to text and it would be fine but when I convert
it to text in excel it drops the zero too. A part number like 010888L is
fine because its treated like text and the zero remains through any
conversion.

Please help.. I have some 9000 part numbers that I need to save to a .csv
and 300 of them start with zero.


.



Relevant Pages

  • Re: convert number to text without losing zeroes
    ... I am not opening the .csv file.. ... I believe excel brings each item in as a custom format if it is all numbers, ... in Excel converting it to a number and dropping the zero. ...
    (microsoft.public.excel.misc)
  • Re: convert number to text without losing zeroes
    ... That was the first thing I tried, and the preceding zeroes disappear. ... I think what happens on import is excel takes any field with all ... Now try saving the file as a CSV ... The problem is coming in when I have part numbers that start with zero. ...
    (microsoft.public.excel.misc)
  • Re: convert number to text without losing zeroes
    ... use a custom format of 000000, then those leading zeros are preserved when excel ... saves the file as a .CSV file. ... treated as a number but retains the zero. ...
    (microsoft.public.excel.misc)
  • RE: Open and Save CSV File
    ... CSV and Excel don't like each other. ... Procedure to export a text file with both comma and quote delimiters in Excel ... "kaiserlich" wrote: ... Leading zero is missing and the double quotation mark is missing. ...
    (microsoft.public.excel.programming)
  • Re: convert number to text without losing zeroes
    ... I've never seen excel drop the leading 0's when saving as a .csv file in any ... You may want to try saving the .csv file and then check using notepad once more. ... always drops the zero. ...
    (microsoft.public.excel.misc)