|
|
Subject:
Excel Formatting Problem: XLS to CSV
Category: Computers > Software Asked by: everyman-ga List Price: $7.50 |
Posted:
11 Jan 2005 08:33 PST
Expires: 10 Feb 2005 08:33 PST Question ID: 455565 |
I have a recurring problem when converting a spreadsheet from .xls to .csv format. I have a column of either 12- or 13-digit numbers (UPC codes) that I need to carry over to a .csv file. There are no special characters or alphas in the number string. Sometimes they have a leading zero (or zeroes), other times they don't. When I convert and re-open the .csv, the number is almost always displayed in scientific notation. Also, I tend to lose the leading zero(es). How can I save the column of numbers when saving the existing .xls as a .csv so that 1) the column is displayed properly upon opening the .csv, and 2) any leading zeros are preserved? |
|
Subject:
Re: Excel Formatting Problem: XLS to CSV
Answered By: webadept-ga on 11 Jan 2005 09:22 PST Rated: |
Hi, You are having this problem because the column is formatting the values as numbers instead of text. Expand the column out so that all of the codes are viewable on the screen (change the column width), then right click on the column header area (the letter), and choose "Format" then choose Text as the format you want to use for that column. Save the file, and then save as CSV. The leading zeros will now be displayed and it will not change long numbers to notation. You should do this with any column, which is not "numeric", a good rule of thumb is if you don't add it, then it is not numeric. Another example is zip codes, adding zip codes is meaningless, so they are text (zip codes also have leading 0's in many areas). There is a website with some very good Excel tips and tricks at Daily Dose of Excel on http://www.dicks-blog.com/ thanks, webadept-ga | |
| |
| |
| |
| |
|
everyman-ga
rated this answer:
and gave an additional tip of:
$2.00
Thanks for staying with it and giving me realistic tips. |
|
Subject:
Re: Excel Formatting Problem: XLS to CSV
From: winsplit01-ga on 11 Jan 2005 08:38 PST |
I think making the format of the numeric fields as general will solve your problem. I do not remember exactly but the catch lies in the number format used for the numeric fields. |
Subject:
Re: Excel Formatting Problem: XLS to CSV
From: winsplit01-ga on 11 Jan 2005 08:47 PST |
OK here it is. Do an import of this CSV file rather than directly opening it. Make the "Column data format" for the fields with leading zeroes as "TEXT". This will retain the leading zeroes. |
Subject:
Re: Excel Formatting Problem: XLS to CSV
From: everyman-ga on 12 Jan 2005 07:13 PST |
valid procedure, but this still does not allow me to save the new file as a csv and reopen correctly formatted. thanks for the try. |
Subject:
Re: Excel Formatting Problem: XLS to CSV
From: pents90-ga on 15 Feb 2005 09:06 PST |
This might not be completely appropriate to this thread, but I've had a similar problem. I work with software that generates CSV files, but those generated files always result in the loss of leading 0s. After trying several tricks, I finally found one that worked. The following line of raw CSV will render a zip code properly: Zip, ="00123", etc. This will render in Excel as: Zip | 00123 | etc. Hope this helps! |
Subject:
Re: Excel Formatting Problem: XLS to CSV
From: rapidcycler-ga on 13 Apr 2005 11:19 PDT |
pents90 you rock!! That solved my problem for generating csv files from Brio reporting to be displayed in Excel! |
Subject:
Re: Excel Formatting Problem: XLS to CSV
From: redmund-ga on 26 Jul 2005 21:56 PDT |
I have been puzzled by this problem for a long time. I used Excel-VBA to create CSV input file for UPS Worldship. And the problem of losing leading zeros in zip codes crops up from time to time. Here is the the real cause: it is NOT that Excel saved the CSV file by stripping the zero! It is that Excel strips the leading zeros when it OPENS the CSV file. So, it you format the data correctly with leading zeros through one of the many ways (such as using '01234 as oppose to 01234), do not re-open the file with Excel to look at it! If you had to look at it, use Notepad. If you had not re-open it with Excel, the CSV file is good for importing by other applications. Learning this helps explain why I only had the problem "from time to time" by not always! |
If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you. |
Search Google Answers for |
Google Home - Answers FAQ - Terms of Service - Privacy Policy |