Importing to Excel from csv AND keep leading zeros

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a script that saves a csv file and mails it to people as a report.
When people open the csv file using Excel the column of account numbers have
leading zeros. Not all but most.

How can I have them open or import to Excel and keep the leading zeros from
that column?
 
Can you amend your script so that it saves the file with a .TXT
extension rather than a .CSV? (If not, then your users will have to
rename the file extension themselves).

Now with Excel running, use File | Open, select "All files *.*" as the
file type, locate your TXT file and click Open - Excel will
automatically take you into the Data Import Wizard. In the third
dialogue box of this, you can specify that you want data in a
particular column to be imported as Text - just highlight the column
and click Text. Do this for each column where you want to preserve
leading zeros, then click Finish.

Hope this helps.

Pete
 
Can you modify your script so that it produces a comma delimited file with
quotes (") as the text qualifier. Excel will automatically recognize the
quote as enclosing a string value and not a numeric one.
 
Back
Top