How to display values with leading zeroes (e.g., 001, 025) in wpDataTables

A guide to preserving leading zeroes in tables regardless of data source or table type

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.


🧩 If You're Importing Data into a Manual Table (Editable)

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.


πŸ”— If You're Linking a Table from a File or External Source (Non-Editable)

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


  1. Create the table using the wpDataTables Table Wizard.

  2. After generation, go to Column Settings.

  3. Change the column type to String.

This ensures that wpDataTables renders the values exactly as they appear in the source β€” including any leading zeroes.

Did this answer your question?
😞
😐
😁