Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Save as CSV and retain format

Status
Not open for further replies.

mart10

MIS
Nov 2, 2007
394
GB
I am using office 2003

I have data extract in one tab from a SQL database which I paste into an Excel tab. on another tab i perform lookups to get data in correct format _ I cant do this directly on the SQL database. When I save a text formated account no as csv file it drops leading zeros and can show long account numbers as say 1.56 etc
 
I assume the problem is that when you import the .csv into Excel2003, it drops leading zeroes from account-numbers because they look like decimal numbers.

One simple approach is to rename your .csv as a .txt. Under these circumstances Excel2003 will seek advice when you try to open it. You must specify that the data are delimitted, by commas. On the third page of the wizard, select the column that contains the problem values, and choose "text" as the format. This will force Excel2003 to import anything as text, even if it looks like a number. A number imported as text will remain as a string of characters (including leading "0" characters) instead of being interpreted as a value.

There may be simpler ways.. watch this space for the real experts...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top