All documentation
Reference
Exports
CSV, Excel, PDF, server-side generation, filter-respecting, audit-logged.
Three export formats, all generated server-side, all respecting active filters.
Enabling exports#
[gravity_table id="42" export="csv,excel,pdf"]
Each format becomes a button in the toolbar. Omit export to hide the toolbar entirely.
Format characteristics#
| Format | File | Best for | Avoid for |
|---|---|---|---|
| CSV | .csv | Spreadsheets, BI tools, scripts | Long text fields with newlines |
| Excel | .xlsx | Stakeholder reports, formatted data | >50,000 rows (memory) |
.pdf | Compliance reports, archives | Editable later (it’s not) |
Filter-respecting#
Exports respect:
- Active column filters (date range, multi-select, range sliders)
- Current search term
- Current sort
- Per-user filter (
filter_by_user="true"users export only their own rows) - Hard-coded filter
The downloaded file matches what the user is currently looking at.
CSV specifics#
- Formula injection auto-prefix: cells starting with
=,+,-,@get a'prepended (Excel renders the value, doesn’t evaluate) - UTF-8 BOM prepended for Excel-on-Windows compatibility
- RFC 4180 quoted-newline handling
Excel specifics#
- Real
.xlsx(OpenXML), not HTML-renamed - Frozen header row
- Auto-fit column widths (capped at 60 chars)
- Number formatting (currency / dates / percentages)
- Conditional formatting preserved from table config
PDF specifics#
- Page numbers (bottom-right)
- Repeating header row across pages
- Brand header (site logo + table name + timestamp)
- Optional cover page (
pdf_cover="true")
Large datasets#
Above 5,000 rows, exports are queued server-side and emailed as a download link.
[gravity_table id="42" export="csv" export_queue_threshold="2000"]
Or send by email regardless of size:
[gravity_table id="42" export="csv" export_delivery="email"]
Per-format permissions#
[gravity_table id="42"
export="csv,pdf"
export_permissions="excel:manager"]
CSV/PDF for everyone; Excel only for users with the manager capability.
Audit trail#
[gravity_table id="42" export="csv,pdf" audit_exports="true"]
Each export logs:
user_id,user_login,ip_addressformat(csv/excel/pdf)row_count(post-filter)filter_state_jsontimestamp(UTC)file_hash(SHA-256)
Useful when “who exported this” matters more than “who has access”.
Security: temporary file lifetime#
Exported files live in wp-content/uploads/gt-exports/ with .htaccess deny-direct-access. Auto-deleted after 24 hours. Shorten:
[gravity_table id="42" export="csv" export_ttl="3600"]
Deletes after 1 hour instead.
On nginx, the equivalent rule is in our recommended nginx config.