How to Preserve Leading Zeros When Exporting PDF Form Data to CSV
Question details
Users need to prevent the loss of leading zeros in numeric fields when exporting data from a PDF form to a CSV file and opening it in a spreadsheet application.

- Product
- Spreadsheet
- Device & OS
- not provided
- Scenario
- Exporting merged PDF form data containing numbers with leading zeros (e.g., 0123) into a CSV format for data processing or record-keeping.
- Observed behavior
- When the exported CSV file is opened directly in spreadsheet software like Excel, numeric values starting with a zero automatically lose the zero and are displayed as standard numbers (e.g., 123).
Before adjusting your spreadsheet settings, right-click the CSV file and open it with a basic text editor like Notepad or TextEdit to verify that the leading zeros were successfully exported from the PDF.
Import CSV Data as Text Using the Import Wizard
By default, spreadsheets automatically detect numbers and remove preceding zeros. Using the Text Import Wizard allows you to force specific columns to be read as text, preserving their exact formatting.
Opening a CSV file directly by double-clicking it bypasses the import wizard, causing the spreadsheet program to apply default 'General' formatting. To keep leading zeros, you must open a blank workbook first and pull the data in manually.
Launch your spreadsheet software (such as Excel or WPS Spreadsheet) and create a new, blank workbook.
Navigate to the 'Data' tab on the top ribbon and select 'From Text/CSV' or 'Import Data'.
Browse your computer for the exported CSV file containing your PDF form data and click 'Import'.
In the preview window or Text Import Wizard, highlight the specific column containing the leading zeros. Change the Data Type or Column Data Format from 'General' to 'Text'.
Click 'Load' or 'Finish' to import the data into your spreadsheet. The leading zeros will now be preserved and displayed correctly.

Manage CSV Imports Seamlessly with WPS Spreadsheet
WPS Office offers a powerful, intuitive Spreadsheet application equipped with an advanced Data Import Wizard. It makes it incredibly simple to import CSV files and set exact column formats so you never lose crucial data like leading zeros.
- 1. Launch WPS Spreadsheet: Open WPS Office on your device and create a new blank Spreadsheet document.
- 2. Use the Import Feature: Go to the 'Data' tab in the ribbon menu and click on 'Import Data', then choose your CSV file.
- 3. Set Data Type to Text: During the import prompt, select the column with leading zeros and change the column format to 'Text' before finishing the import.

Frequently Asked Questions
Why do leading zeros disappear when I open a CSV in Excel?
Spreadsheet programs automatically format data that looks like a standard number to make calculations easier. In doing so, they drop any leading zeros because they are mathematically insignificant. The zeros still exist in the CSV file but are hidden by the application's default 'General' formatting.
Can I format the cells to get the zeros back after opening the CSV?
No. Once the CSV is opened directly and the zeros are removed by the software, simply changing the cell format to 'Text' will not restore them. You must use the Text Import Wizard from a blank workbook to specify the text format before the data populates the cells.
Is there a way to force a CSV to keep leading zeros without using the import wizard?
Yes, if you have control over the data export script or PDF export settings, you can append a hidden apostrophe (') before the number, or wrap the data in quotes with an equals sign (e.g., ="0123"). This forces the spreadsheet program to read the value strictly as text.
How can I check if my PDF form actually exported the leading zeros?
You can view the raw data by right-clicking your CSV file, selecting 'Open with', and choosing a basic text editor like Notepad (Windows) or TextEdit (Mac). If the leading zeros are visible there, the PDF export was successful, and the issue is solely with how the spreadsheet application imports the data.




