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. WordPress powers 43% of all websites globally (W3Techs, July 2026), and TableCrafter bridges the gap between the data you collect and the tables your users need to see, no custom PHP, no dashboard access required for viewers, and no per-row limits on the free tier. The free version on WordPress.org supports CSV, JSON, Google Sheets, and Excel. Pro adds Gravity Forms, Airtable, Notion, WooCommerce, REST APIs, inline cell editing, export to CSV/PDF, role-based column visibility, and auto-refresh. Every table embeds on any page with a. Shortcode embeds remain compatible with 100% of WordPress themes regardless of page builder (WordPress Codex).
How Do I Enable 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.
The shortcode accepts all column and filter settings defined in the table builder as defaults, but you can override individual parameters inline. For example, `[tablecrafter id="1" per_page="25"]` overrides the default rows-per-page setting for this specific embed without changing the saved table configuration. This lets you reuse one table definition across multiple pages with different display requirements.
What Is 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.
What Is 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.
What Is 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.What Is PDF Export: Layout-Aware and Print-Ready?
PDF export in TableCrafter works through the browser's built-in print-to-PDF functionality, not a server-side rendering engine. There is no plugin-side PDF layout configuration panel, no logo upload setting, and no margin or header configuration in the table admin. When a visitor clicks the PDF button in the export toolbar, toolbarDownloadPDF() triggers the Print button click, which runs a print preparation sequence before opening the browser's native print dialog.
When print_all_rows is enabled (the default), TableCrafter fetches up to 5000 rows via AJAX before calling window.print(). The print header element (.gt-print-header) is populated at that moment with the WordPress page title, an export timestamp, and a plain-text summary of any active filters the visitor applied. An afterprint listener then restores the original pagination state once the user dismisses the dialog.
The browser's print dialog gives visitors control over page orientation, scale, margins, and paper size. Choosing Save as PDF in that dialog produces the file. The print output reflects the table exactly as it appears in the browser, including the CSS styles and any columns currently visible. PDF is the right choice when you need a read-only, point-in-time snapshot of filtered data that is ready to share or archive without further editing.
How Does Choosing the Right Format Work?
The right export format depends on what the recipient will do with the data:
Use for importing data into another system: a CRM, a data warehouse, a spreadsheet tool like Google Sheets, or a script that processes rows. CSV is plain text, universally compatible, and adds no formatting overhead. It preserves values exactly as stored, including empty cells and special characters. Not ideal for sharing with non-technical stakeholders who need the data to be readable without additional tools.
Use when handing data to a team member for further analysis. The recipient gets a structured spreadsheet with correct data types: numbers stay numeric, dates stay sortable, text stays text. Excel files open natively in Microsoft Excel, Google Sheets, and LibreOffice. Pro users can configure column formatting rules (currency, percentage, two decimal places) that apply in the exported XLSX but not the CSV version.
Use when sending a read-only snapshot to a client, printing a physical record, or archiving data at a point in time. Clicking the PDF export button triggers the browser's print dialog, where visitors choose Save as PDF to produce the file. When print_all_rows is enabled (the default), TableCrafter loads all rows up to 5000 before opening the dialog so the saved file contains the full current dataset. The print header automatically shows an export timestamp and active filter summary, giving recipients context about what the document contains.
How Do Export and Column Visibility Work?
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.
For the PDF path specifically, column visibility state carries into the print output because the browser's print renderer honors the CSS display state of table cells. Columns hidden via the picker have display:none applied to their cells, so the browser excludes them from the printed layout. There is no separate PDF-specific column exclusion setting in the plugin. The column set visible in the table at the moment the print dialog opens is exactly what appears in the exported file.
This configuration interacts with any caching or CDN layer active on your WordPress installation. If you use WP Rocket, LiteSpeed Cache, or a CDN such as Cloudflare, flush the page cache after making this change to ensure the updated configuration is reflected in the cached HTML served to visitors. TableCrafter's server-side output is regenerated on the next uncached request.
What Are the Next Steps?
With the three export formats covered, you can explore more targeted scenarios. Role-based export permissions let you restrict the export buttons to specific WordPress user roles, so a customer-facing table allows viewing but not downloading. Add export="false" as the default and override it per embed for admin users who need it.
For the filtered export pattern, apply the search and filter controls before clicking any export format. CSV and Excel capture the visible rows at that moment via getVisibleTableData(), which scrapes the live table DOM. This means a visitor who filtered to March invoices gets only March invoices in the downloaded file, without any additional configuration on your end.
For PDF specifically, the next step is verifying layout in your theme. Load a table page, apply representative filters, and open the browser print preview before distributing any reports. Check that the print header shows the correct filter summary, that column widths are readable, and that the orientation fits the table's column count. Landscape works better for wide tables with six or more columns. Each of these patterns is covered in the guides that follow in this series.
Frequently Asked Questions
How Do I Enable the Export Button?
Export is disabled by default. To turn it on, add export="true" to your shortcode:
What Is TableCrafter?
TableCrafter is a WordPress plugin that turns data from Gravity Forms, Google Sheets, Airtable, Notion, REST APIs, CSV files, and WooCommerce into interactive, sortable, filterable frontend tables. Embed any table on any WordPress page with the [tablecrafter] shortcode or the native Gutenberg block. No PHP or custom development required. The free version supports CSV, JSON, Google Sheets, and Excel. Pro adds Gravity Forms, Airtable, Notion, WooCommerce, REST APIs, inline cell editing, export to CSV and PDF, role-based column visibility, and auto-refresh.
Does this require PHP or developer skills?
No. TableCrafter is configured entirely through the WordPress admin interface. You choose your data source, map fields to columns, and set display preferences using point-and-click controls. Embedding uses the [tablecrafter] shortcode or the native Gutenberg block.
Is the free version sufficient or do I need Pro?
The free plugin on WordPress.org supports CSV, JSON, Google Sheets, and Excel sources with unlimited tables, rows, and columns. Pro adds Gravity Forms, Airtable, Notion, WooCommerce, REST API sources, inline cell editing, bulk row actions, export to CSV and PDF, role-based column visibility, and auto-refresh every N seconds.
Ready to try it?
TableCrafter is free on WordPress.org. Pro unlocks inline editing, role-based permissions, and advanced data sources.