How to Export a WordPress Table to Excel with Formatting

Updated July 2026 • 6 min read • By Fahad Murtaza

TableCrafter table builder, connect Gravity Forms, Google Sheets, Airtable, CSV, or JSON data sources
TableCrafter table builder, connect Gravity Forms, Google Sheets, Airtable, CSV, or JSON data sources

TableCrafter's Excel export produces a proper XLSX file, not a renamed CSV, with structured column headers, correct data types, and enough formatting to be immediately useful in Microsoft Excel or Google Sheets. Understanding exactly what is and is not preserved in the export saves you from surprises when the file lands on a colleague's screen. 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 [tablecrafter] shortcode or the native Gutenberg block. Frontend editing reduces admin support requests by an average of 42% in multi-user WordPress environments (WP Buffs, 2024).

How Do I Enable Excel Export?

Add export="true" to your shortcode to enable the export button. The button appears in the table toolbar above the data rows, labeled "Export":

[tablecrafter id="1" export="true"]

When the visitor clicks Export, a dropdown appears with the formats enabled for this table (CSV, Excel, and/or PDF depending on your TableCrafter plan and table configuration). When they select Excel, TableCrafter generates an XLSX file server-side using PhpSpreadsheet and triggers a browser download. The file name defaults to the table's configured display name plus the export date, for example, delivery-log-2026-06-24.xlsx. You can override the default file name pattern in the table builder under Export Settings.

The export button is visible only to users with the minimum role required to view the table. Visitors below the minimum role threshold see neither the table nor the export button. If you want the table visible to all visitors but the export button restricted to logged-in users only, configure the table's "Minimum role to export" setting separately from the "Minimum role to view" setting in the table builder Access tab.

What the XLSX File Contains?

The generated XLSX file includes the following structural elements:

If this step produces unexpected output, check the source data directly in the connected system. TableCrafter passes data through without modification — if a cell displays an unexpected value, the source record contains that value. Use the TableCrafter debug log (Settings > Advanced > Debug Mode) to trace the exact query sent to the source and the raw response received, which narrows the diagnosis to either a source-side or rendering-side issue.

How Does Formatting That Is Preserved Work?

Bold Header Row

The header row (row 1) uses bold font weight. This is applied via Excel's cell formatting, not a styled row color, so it prints correctly in black and white and works in all spreadsheet applications.

Column Width Hints

TableCrafter sets initial column widths in the XLSX file based on the header label length. A column labeled "Email Address" gets more width than one labeled "ID". These are approximations, Excel may auto-adjust them further when the file opens, depending on the user's Excel settings.

Column widths in the XLSX file are not tied to the CSS widths of the web table. They are calculated independently during export.

Data Types: Numbers, Dates, Text

This is the most important difference between XLSX and CSV. TableCrafter exports cells with explicit data types:

Data type mapping happens based on the column type set in TableCrafter's column configuration. A column set to type Number or Currency exports as a numeric cell. A column set to type Text exports as a text cell even if the values happen to be numeric.

How Does Formatting That Is Not Preserved Work?

The XLSX export does not carry over visual styling from the web table. The following are excluded by design:

If a column shows a human-readable label in the table (via a lookup field) but stores a raw ID in the database, the XLSX exports the resolved label, not the raw ID, as long as the column is configured as a lookup field type in TableCrafter. This matches what the user sees on screen.

How Do I Use the Excel Export in Microsoft Excel?

Opening the XLSX in Excel:

  1. Double-click the downloaded file or use File > Open in Excel.
  2. The file opens with the header row frozen and bold. Data starts on row 2.
  3. Excel may show a "Protected View" banner for files downloaded from the web. Click Enable Editing to interact with the file.
  4. Numeric columns are immediately available for SUM, AVERAGE, and other formulas.
  5. Date columns are sortable by date order, not alphabetically, because they are stored as date values.

To auto-size all columns for better readability:

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.

  1. Click the triangle in the top-left corner of the spreadsheet to select all cells.
  2. Double-click any column border in the header row. All columns auto-fit their content.

How Do I Use the Excel Export in Google Sheets?

Google Sheets imports XLSX files with high fidelity:

  1. Open Google Drive and click New > File upload, then select the XLSX file.
  2. Once uploaded, right-click the file and select Open with > Google Sheets. Google Sheets converts the XLSX to a native Sheets format.
  3. Alternatively, go to sheets.google.com, click Blank, then File > Import and upload the XLSX.

Data types are preserved: numbers remain numbers, dates are recognized, and the bold header row transfers cleanly. Column widths may shift slightly because Sheets and Excel handle default character widths differently.

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.

How Does Export Column Order Work?

The XLSX file columns appear in the same order as the columns in the web table as configured in the TableCrafter admin. If you have reordered columns using the drag-and-drop column reordering in the table builder, the XLSX reflects that admin-configured order exactly. If the visitor has reordered columns using the column picker on the frontend, the export uses the admin-configured order, not the visitor's customized view order — the XLSX represents the canonical column arrangement, not an ephemeral per-session arrangement.

Hidden columns (columns with visibility toggled off in the Display tab) are not included in the XLSX export. This allows you to store fields like internal IDs or audit timestamps in the Gravity Forms source without exposing them in either the web table or the exported file. If you need a separate export that includes hidden columns for internal use, create a second table configuration with those columns visible and restrict that configuration to administrators only.

What Are the Next Steps?

The XLSX export is ready to use out of the box, but you can tighten the experience further. Restrict who can trigger exports using role permissions so sensitive financial data stays within the right team, or combine filtered export with XLSX to give users a scoped data extract instead of the full dataset. Both features are covered elsewhere in this guide series.

Frequently Asked Questions

How Do I Enable Excel Export?

Add export="true" to your shortcode to enable the export button:

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.