1.

Solve : Leading 0 in.csv file disappears when opened in Excel?

Answer»

I have a list I purchased and downloaded in Excel. In the Excel spreadsheet I have a column of zip CODES. Many of them BEGIN with a leading zero ie. 07704. In Excel this displays correctly. I need to CONVERT the Excel file to a .csv file - which is the easy part, "Save As" .csv. When converted to .csv and then re-opened, HOWEVER, the leading zero disappears and it shows only 4 digits: 7704. I have read that because the Excel program opens up the .csv file, Excel automatically truncates all leading zeros from numbers in .csv files. I read the solution [or "a" solution] is to to "open up Excel document, convert the whole sheet to text format, and save as .csv". My challenge is: how to convert whole sheet to text format? I don't think it means to save the Excel sheet as a .txt file, because I tried that and when i then open up the .txt file there is no way to save it as a .csv file - let alone the fact that the data on the page is no longer recognizably formatted. So what does it mean to convert Excel data to text format before I save as .csv?This is always a complete PAIN with Excel (I work with CSV files a lot) - The other fun one is when it decides to convert fields containing numbers with slashes in them into dates...

When people say to convert it to text format, they are referring to changing the cell type, to do this, select all the cells (or just the affected columns), right click and go to "Format Cells". In this window you can select "Text" to prevent Excel from trying to be smart with cells containing numbers.Ok, I opened the Excel sheet, clicked on the most upper left-hand cell to select the entire sheet, right-clicked and chose "format cells", clicked on "text", clicked of "file" and "save as" and chose ".csv" and saved. When I re-open the new .csv spreadsheet, the leading zero is still missing. Here's another wrinkle to the same question: why does the .csv file recognize a leading zero with a 9-digit zip code? The zero does not disappear when I open/re-open a .csv file with a zip code like: 08736-2115



Discussion

No Comment Found