How to Automatically Email a Table Export as an Attachment

Sending a fresh copy of your data table to stakeholders every morning, without touching WordPress, is one of those things that sounds like it requires a custom developer build. With TableCrafter Pro, it is a configuration step. This guide walks through combining TableCrafter's scheduled export and email alert features so a CSV or Excel attachment lands in any inbox on your schedule. 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. 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, Excel, and JSON, role-based column visibility, and auto-refresh. Every table embeds on any page with a [tablecrafter] shortcode or the native Gutenberg block. CSV remains the most universally supported data exchange format, used by 91% of business intelligence tools (Gartner, 2025).
What You Need Before You Start?
This workflow requires the following:
After completing this step, verify the result by viewing the page as a logged-out visitor in an incognito window. This confirms the table behaves correctly for public visitors rather than reflecting admin-level permissions that may hide configuration issues during initial setup. Check both the rendered output and the browser console for any JavaScript errors.
- Pro TableCrafter Pro activated on your WordPress site, the export and email alert features are Pro-only.
- A configured table pulling data from Gravity Forms, Google Sheets, REST API, Airtable, or WooCommerce. If you have not built a table yet, go to TableCrafter → Tables → Add New and walk through the table builder first.
- A working WordPress mail setup. Most hosts either configure
wp_mail()by default or you will need an SMTP plugin such as WP Mail SMTP. Send a test email from Settings → General or your SMTP plugin's diagnostic tool before continuing.
wp_mail() so they respect whatever mail transport your site already uses, including transactional providers like SendGrid, Mailgun, or Postmark.Step 1: Enable export on your table
Open the table you want to send. Go to TableCrafter → Tables, hover over the table name, and click Edit. Inside the table builder, locate the Export tab in the settings panel on the right side.
Toggle Enable Export on. Three format checkboxes appear:
csv, plain comma-separated values, compatible with every spreadsheet applicationexcel,.xlsxformat with column headers preservedpdf, formatted for print or archival; respects column visibility settings
Select at least one format. For automated email attachments, CSV and Excel are the most practical choices because they stay small even with thousands of rows and open directly in Excel or Google Sheets without any conversion step.
You can also configure which columns appear in the export independently from what is displayed in the table. Use the Column Visibility picker to hide columns from the on-screen table while still including them in the export, or vice versa, useful when you want to expose internal IDs to the email recipient but not to website visitors.
Step 2: Configure the email alert
Still inside the table builder, navigate to the Scheduled export section. This controls the recurrence, file format, and the optional email delivery for each automated export run.
The key settings for a scheduled attachment workflow are:
- Email recipients, one or more addresses separated by commas or spaces. Leave this field empty if you only want the file written to disk without sending email. Multiple recipients are supported, for example
alice@example.com, bob@example.com. - Format, choose CSV or XLSX. CSV is the safest default: it opens in every spreadsheet tool without conversion and transfers as a small file even with thousands of rows. XLSX preserves column headers and is useful when recipients work primarily in Excel.
- Filename pattern, customize the exported filename with date tokens:
{table_name},{YYYY-MM-DD},{table_id}, and others. The default pattern produces names likemy-table-2026-07-06.csv. - Trigger, see Step 3 for the recurrence and event-based trigger options.
Each export run writes the file to wp-content/uploads/gravity-tables-exports/ first, then emails it to configured recipients if any are set. A mail delivery failure does not cancel or retry the export run; the file on disk is the primary output and is always written regardless of email success. Recipients receive the file as a standard attachment via wp_mail(), routed through whatever SMTP provider your site already uses.
What Is Step 3, Choose a Trigger: Scheduled vs. Event-Based?
TableCrafter Pro supports two families of triggers for email alerts:
Scheduled (Time-Based)
In the Scheduled export section, enable the export toggle and choose a recurrence:
Hourly - runs every hour
Every 6h - runs every six hours
Daily - runs once per day
Weekly - runs once per week
Each run writes the export file to wp-content/uploads/gravity-tables-exports/ using the filename pattern you configure. The file is written to disk on every run, and emailed to configured recipients if any are set. Use the Run export now button at the bottom of the Scheduled export section to trigger an immediate run for testing, bypassing the cron schedule entirely.
Scheduled exports run via WordPress Cron (wp-cron.php). On sites with consistent traffic, WP Cron fires close to the scheduled interval. On low-traffic or development sites, the cron hook waits for a page visitor to trigger it, which can cause runs to slip by an hour or more. To guarantee on-time delivery, configure a true server-level cron job to request https://yoursite.com/wp-cron.php on the same interval. Most hosting control panels expose this under Cron Jobs or Scheduled Tasks; the command is typically curl -s https://yoursite.com/wp-cron.php > /dev/null 2>&1.
Event-Based
The Email Alerts (Pro) section of the table builder handles event-driven notifications. These fire when a field value crosses a configured threshold as a result of a write action, not on a schedule. The write actions that can trigger an alert are:
- An inline cell edit that changes a monitored field's value past the threshold
- A bulk column-fill that writes a new value across multiple rows, crossing the threshold on any affected row
- An entry duplicate where the duplicated entry contains a value that satisfies the rule
The alert fires only on the crossing moment: the new value must satisfy the configured condition and the old value must not have. This prevents repeated notifications when a field already exceeds the threshold and gets updated again without recrossing. Each alert rule specifies one Field ID, one operator (such as >, <, =, >=, <=, or contains), one threshold value, and one recipient address. Configure separate rules targeting the same field if you need the same condition to notify multiple people.
The alert email subject is auto-generated: [TableCrafter Alert] Field "field name" crossed threshold on table "table name". The body includes the field label, old value, new value, the condition that was crossed, and a direct link to the table editor in your WordPress admin. When the attach_csv flag is set on a rule, the email includes a CSV export of the full table at the moment the alert fired, giving the recipient complete context rather than just the changed value.
Step 4: Test before going live
Save your table settings. Use the Run export now button at the bottom of the Scheduled export section to trigger an immediate export run. This bypasses the cron schedule and delivers the export file to configured recipients right away, letting you verify the file contents and email delivery before the first scheduled run fires.
Check the following when the test email arrives:
- The attachment opens correctly in your spreadsheet application and contains the expected columns and rows.
- Column headers match what you expect, TableCrafter uses the label you set in the column builder, not the Gravity Forms field key.
- Any lookup fields (ID-to-label resolution) are resolved in the export. For example, a user ID column should show the display name, not the raw integer, if you configured a lookup field for it.
- Date fields use your configured format. TableCrafter respects the date display format set per column; the export inherits the same format.
- Row count in the attachment reflects your active filters. If you applied persistent filters on the table (for example, showing only entries from the last 30 days), the export includes only the filtered rows, not the full dataset.
If the test email does not arrive within a few minutes, check your host's mail logs or your SMTP plugin's log. All TableCrafter AJAX calls and background tasks go through wp-admin/admin-ajax.php with nonce validation, so a failed email is almost always a mail transport issue rather than a TableCrafter configuration problem.
What Is Advanced: Filtering the Export by Role or Query?
Pro TableCrafter's role-based permissions apply at the table level and the column level, but you can also narrow the data included in a scheduled export using the table's Advanced Filters before saving.
For example, suppose you manage multiple drivers and want each region manager to receive only their drivers' load data. The approach is:
- Create a separate table per region with an Advanced Filter applied locking the
regionfield to the relevant value. - Configure a scheduled email alert on each table pointing to the appropriate manager's address.
- All three tables can read from the same underlying Gravity Form, TableCrafter handles the query filtering at render and export time.
This avoids any custom PHP and keeps everything inside the TableCrafter admin interface. Each manager gets a scoped export with no risk of seeing another region's data.
[tablecrafter id="42"]
[tablecrafter id="43"]
[tablecrafter id="44"]
Each shortcode renders the appropriate region's table on the front end, and each table's scheduled export emails the matching manager. Embed each table using the canonical [tablecrafter id="X"] shortcode format.
Frequently Asked Questions
Step 1: Enable export on your table
Open the table you want to send. Go to TableCrafter → Tables, hover over the table name, and click Edit. Inside the table builder, locate the Export tab in the settings panel on the right side.
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, Excel, and JSON, 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, Excel, and JSON, 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.
Column order is preserved across sessions. Once you set a column order in the table builder, that order persists in the shortcode output for all visitors. Users with the column reorder permission can adjust their own view without affecting the default seen by others.
The column mapping you define here is stored as a JSON configuration in the WordPress database. You can export this configuration using the TableCrafter export tool and import it to another table or another site. This is useful when replicating a table layout across multiple pages or when migrating a table to a staging environment for testing before going live.