Leading Zeroes in a CSV
Posted by Matthew on January 03, 2002 12:06 PM
I have written an ASP page that downloads a CSV file of data. This ASP page is used by hundreds of people in my company. Most of them are not tech savvy.
In this data are some IDs that should be treated as Text but, when the file is opened in Excel, they are treated as numbers. Leading zeroes are dropped.
I have tried to enclose the IDs in double quotes, but the leading zeroes are still dropped.
I have tried starting each field with a single quote, in an attempt to alert Excel that the field is text, but the single quote appears in the cell with the actual value of the ID. That is unacceptable.
Is there any way to "trick" Excel into treating a numeric field as text - without displaying unwanted characters in the cell? The solution MUST involve a CSV file being opened in Excel. Someone suggested I use XML, which is all fine and good - but my tech savvy users would have a heart attack.
Thanks for your time,