• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

How to Keep/Retain leading Zero’s when I Save as a .CSV file

ChaCha90

New Member
When I save my excel spreadsheet as a .CSV file I need to keep the leading zeros for the numbers listed in column “A” so that when I import/upload it to our Program/System it will not lose the data format/leading zeros for the items listed in column “A”. *Note that the items listed in column “A” all start with a Zero and must have 9 digits.
 

Attachments

  • sample 1 (keep leading Zeros - Save as CSV).csv
    385 bytes · Views: 6

ChaCha90

I opened Your file and it asked as below ...
Screenshot 2024-03-17 at 18.07.43.png
I selected Don't Convert ...
It opened with leading zeros.
Screenshot 2024-03-17 at 18.13.27.png
I saved it as .csv ...
and
Your file looks same as Your original.
Screenshot 2024-03-17 at 18.11.30.png
Have You tested as above?
 

ChaCha90

I opened Your file and it asked as below ...
View attachment 86735
I selected Don't Convert ...
It opened with leading zeros.
View attachment 86737
I saved it as .csv ...
and
Your file looks same as Your original.
View attachment 86736
Have You tested as above?
The system I have to Upload the spreadsheet to only accepts it in the .CSV format. The issue I am having is when I ‘save’ the spreadsheet as ‘.CSV’ the Leading Zero(s) for the items in column “A” drop off I guess by default because the item number starts with a Zero and thus the system that the file is being Uploaded to does not recognize the item number because the item number is only showing as 8 or 7 digits versus the “9 digits” that the system will recognize.
 

ChaCha90

You offered here csv-file.
Where do You get those datas there (in .csv-file)?
If You'll get those datas somewhere else than from ... csv-file,
then please upload here a sample Excel-file
which You should save as .csv-file with leading zeros or so.
 
Chacha90, according to your csv attachment which contains the leadings zeros so the issue is very not on Excel side …​
 
Usually the issue is that you are checking the file by opening it in Excel, at which point Excel will indeed remove the leading zeroes. That does not mean that they are not present in the CSV file! Test that by opening it in Notepad or another text editor, not in Excel.
When Excel saves a file in CSV format, it saves the values as they are displayed in the cells.
 

ChaCha90

I'm still waiting for Your sample Excel-file, which has Your challenge...
Test this Yourself ..
If Your Excel-files cell A1 has formatted as Text ... You can write there 0000001. You can see it as written 0000001.
If cell has eg General format, of course You can write there same 0000001, but 'Excel' take cares it as 1. You can see it as 1.
Screenshot 2024-03-19 at 12.44.38.png
If You SaveAs Your Excel-file as CSV-file then
Your (cell's A1) 0000001 will saved as 0000001 and
Your (cell's A1) 1 will saved as 1
as in above snapshot.
 
Back
Top