When working with Excel, CSV, Google Sheets, JSON, or PHP arrays, you might notice that values like 001
or 025
are automatically converted to 1
or 25
. This happens because most tools treat these as numbers and strip the leading zeroes.
The solution is simple: ensure wpDataTables treats these values as text, not numbers.
Use this method when you're uploading a file (like Excel or CSV) into wpDataTables to create an editable table stored in your database.
Step 1: Format the column as “Text” in your source file
In Excel: Right-click the column → Format Cells → select Text.
This ensures that Excel won’t remove the leading zeroes when saving.
Step 2: Choose “String” as the column type during import
When importing the file using the Table Constructor:
Set the column to One-line string for short entries → stored as VARCHAR
Or Multi-line string for longer text → stored as TEXT
This will preserve values like
001
, 025
, etc., exactly as they are.
Note:
Columns saved as text will act as text strings, meaning they cannot be numerically sorted or filtered.
Use this method if you're creating a non-editable table by linking directly to a data source such as:
Excel
CSV
Google Sheets
JSON
PHP array
Create the table using the wpDataTables Table Wizard.
After generation, go to Column Settings.
Change the column type to String.
This ensures that wpDataTables renders the values exactly as they appear in the source — including any leading zeroes.