How to Export a WordPress Table to CSV, Excel, and PDF
TableCrafter gives every table an export button that lets site visitors or admins download the visible data in three formats: CSV, Excel (XLSX), and PDF. Each format serves a different purpose, behaves differently under the hood, and delivers a different output file. This guide walks through the full export workflow so you know exactly what to configure and what to expect from each format.
Enabling the Export Button
Export is disabled by default. To turn it on, add export="true" to your shortcode:
[tablecrafter id="1" export="true"]
This renders a toolbar above the table with an Export button. Clicking it opens a small format picker — CSV, Excel, PDF — and triggers the download immediately after selection.
If you want export alongside filtering and search, combine the attributes:
[tablecrafter id="1" filter="true" search="true" export="true"]
The export button will respect whatever active filters are applied at the moment the user clicks it, which is covered in detail in the filtered-export guide.
What Gets Exported: Visible Rows vs All Rows
This is the most important behavioral distinction to understand before going further. TableCrafter has two export modes controlled in the table admin under Export Settings:
- Export visible rows only: Only the rows currently showing in the table are included in the download. If the user has applied a filter or search query, only the matching rows export.
- Export all rows: Ignores active filters and exports the full dataset. Useful for admin use cases where you want a complete data dump regardless of what the visitor is viewing.
Both modes apply to all three export formats.
CSV Export: Plain, Universal, Fast
CSV is the simplest format. Each row in your table becomes a line in the file, with cell values separated by commas. The first row is always the column headers as configured in TableCrafter's column settings.
What CSV includes:
- Plain text values for every visible column
- Column headers as the first row
- Proper escaping for values that contain commas or quotes
- UTF-8 encoding by default (critical for accented characters and non-Latin scripts)
What CSV does not include:
- Any formatting — no bold, no colors, no column widths
- Badge labels rendered as HTML — the raw underlying value is exported instead
- Computed display values from lookup fields — the source key is exported, not the resolved label
CSV is the best choice for importing into other systems — databases, CRMs, accounting tools — because the plain text format is universally compatible.
Excel Export: Structured and Spreadsheet-Ready
The XLSX export produces a proper Excel file using the Open XML format. It opens natively in Microsoft Excel, Google Sheets, LibreOffice Calc, and Numbers.
Compared to CSV, the XLSX file includes:
- Bold header row: The first row uses bold font weight so headers stand out visually.
- Column width hints: TableCrafter sets approximate column widths based on the header label length. They are a starting point, not pixel-perfect matches to the web table.
- Data type awareness: Numeric columns are exported as number cells, not text. Date columns are exported as date values. This means Excel can sort and calculate them correctly without manual reformatting.
- Frozen header row: Row 1 is frozen so the header stays visible when scrolling down large datasets.
What XLSX does not preserve:
- Color-coded badges or status indicators
- HTML rendered inside cells (progress bars, icon sets)
- Custom font styles applied via CSS
1200 and applies an Excel number format. This is correct behavior — it lets Excel perform math on the values.PDF Export: Layout-Aware and Print-Ready
PDF export renders the table into a document using a server-side layout engine. The result is a paginated file with headers and footers, suitable for sharing with people who should not be editing the data.
What the PDF includes by default:
- Table title (pulled from the TableCrafter table name)
- Column headers repeated on each page
- All visible rows, paginated automatically
- Page numbers in the footer
- Export timestamp
PDF-specific configuration options (found under Table Settings > Export > PDF Options):
- Page orientation: Portrait or Landscape. Use Landscape for wide tables with many columns.
- Logo: Upload a logo image to appear in the document header.
- Header text: Custom text above the table (e.g., company name, report title).
- Footer text: Custom text below the table or in the footer area.
- Column exclusions: Select specific columns to hide from the PDF export without hiding them from the web table.
PDF is the right format when you are sending reports to clients, printing records for compliance, or producing invoices that should not be edited.
Choosing the Right Format
Importing data into another system. Lightweight, universally compatible, no formatting overhead.
Handing data to a team member for further analysis. They get a structured spreadsheet with correct data types.
Sending a formatted report to a client or printing a record. Non-editable, branded, pagination-aware.
Export and Column Visibility
TableCrafter's column visibility settings interact with export in a predictable way: columns hidden via the column picker in the table toolbar are excluded from all exports. Columns hidden in the admin configuration (set to not display) are also excluded. The rule is simple: if a column is not visible in the table, it does not appear in the export.
The exception is the PDF column exclusion list mentioned above, which lets you hide specific columns only from the PDF export while keeping them visible in the table and in CSV/XLSX exports.
Next Steps
With the basics covered, you can move on to more specific export scenarios: restricting who can export via role-based permissions, exporting only filtered rows, customizing the PDF layout with a logo and header, or scheduling automatic exports sent by email. Each of these is covered in dedicated guides in this series.
Ready to try it?
TableCrafter is free on WordPress.org. Pro unlocks inline editing, role-based permissions, and advanced data sources.