TROUBLESHOOT

Save leading zeroes when opening a CSV file in a spreadsheet

CSV Troubleshoot
If your CSV data contains numbers with leading zeros (like "003456"), those zeros can "disappear" if you import the file into a spreadsheet.

Let's see how to solve this problem with Excel, as it is one of the most common spreadsheet software.

Why do zeros disappear? Simply put, when Excel sees numbers in CSV, it converts them to a numeric format by default, and zeros at the beginning are discarded, which can result in data loss.

Now let's see how to avoid this. First, do not open your CSV via Open! Use a special Import Wizard to import your data into Excel.

1. Open the spreadsheet where you are going to import data from the CSV.

2. Click the Data tab, then Get External Data, and choose From Text to launch Text Import Wizard.
3. Find the CSV file and click Import.

4. Select the "Delimited" file type.

5. Start the import with line 1 (usually it is selected by default).
6. Choose a delimiter. It can be a comma or other delimiter. You can see one in the Import Wizard preview to be sure.

7. Choose a text qualifier. Most commonly used are quotation marks (""), but, again, if you're not sure, choose this option.
8. You must now select a data format for the column with leading zeros. In this step, click on it and choose the "Text" format. This will prevent Excel from reading the data as numbers and converting it accordingly.
9. Now confirm where you want to import the data (i.e., select the name of a spreadsheet) and click Finish.
Again, if you need to save the data in CSV format without losing the zeros at the beginning, the easiest way is to format the data in the column as text. Simply highlight the column(s) and go to "Number Format" to select "text" from the drop-down list. This will indicate that the data in that column should be saved as plain text. When you export data in a CSV file, this data will be stored with all of the required leading zeros.