How to import data with leading zero

I have a CSV file that has zip codes in one column. Some zips start with a zero. I cannot figure out how to get Numbers to respect the leading zero. Whenever I open or import the file, the cell formatting goes to automatic and the zeros are lost. (I have verified by looking at the CSV file in an editor that the zeros are there.)

I tried creating a sheet with all the appropriate columns and set the formatting of the zip column to text, but when the csv file is placed in the sheet, the cells switch to automatic and the leading zeros are lost.

Any help would be appreciated.

2009 MacBook Pro 15 inch 2.53 Core 2 Duo, Mac OS X (10.5.7)

Posted on Oct 26, 2009 7:38 PM

Reply
5 replies

Oct 27, 2009 12:57 AM in response to ProfT

Revise your CSV file to indicate that all data is text. In a Text editor, use Find/Replace to Find the comma (,) and replace it with a comma followed by a single straight quote (,'). You'll also need to enter one manually before the first piece of data (if this is a number which you want to have treated as text).

The straight single quote is a flag that indicates what follows is to be treated as text. While you may be able to see it in the entry bar when you select a cell, the flag does not display in the cell, nor does it print.

Flagging everything is generally easier than flagging only the codes with leading zeroes.

Regards,
Barry

Oct 27, 2009 6:22 AM in response to Barry

Thanks, Barry. I never considered altering the input data! Your solution is most helpful. Meanwhile, I've given Apple feedback that if Numbers is to be a serious contender for users to consider over Excel, it needs an import function with some controls not just the drag and drop option currently in place. In so many ways, I prefer Numbers, but some of these "missing features" that require workarounds are significant obstacles.

Many thanks!

Oct 28, 2009 12:43 AM in response to ProfT

Actually, I 'discovered' this while using OpenOffice.org, an Open Software Office 'clone' to clean up some data before moving it from an old Library Management System application that used a fixed field length DB system. To get the data into OOo, it had to be exported from the original application in dBase format ( a .dbf file ), which cold then be imported into an OOo spreadsheet (or, I assume into Excel).

After the import, I noticed that the "numbers" had retained their leading zeros, and when I clicked on one the value in the entry bar began with a straight single quote. That led to a little experimentation with Numbers after reading your question, and to the answer I supplied.

Your feedback to Apple makes sense to me.

Thanks for the feedback here.

Regards,
Barry

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How to import data with leading zero

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.