in reply to Re: Retaining leading Zeros in csv file
in thread Retaining leading Zeros in csv file

Expanding point #2: MSExcel does trim leading zeros from any field data recognized as number (i.e. can be converted to a number) when reading from a CSV file.

It is a very annoying "feature" and I never found a way to disable it. The only "solution" I found is renaming the .csv file to .txt to prevent automatic parsing, importing it as a text delimited file and then forcing all column to text mode.

If you need to generate a file from Perl to be used by Excel I strongly suggest Spreadsheet::WriteExcel

Rule One: "Do not act incautiously when confronting a little bald wrinkly smiling man."

  • Comment on Re^2: Retaining leading Zeros in csv file

Replies are listed 'Best First'.
Re^3: Retaining leading Zeros in csv file
by harishnuti (Beadle) on Jul 02, 2008 at 15:13 UTC
    Thx for the suggestions.. seems nothing can be done from coding side to overcome the above excel functionality ...i will consider renaming it into .txt and then importing from excel ....