Skip to content

feat: support XML and CSV exports for form submissions - #2924

Open
girishpanchal30 wants to merge 3 commits into
developmentfrom
feat/2884
Open

feat: support XML and CSV exports for form submissions#2924
girishpanchal30 wants to merge 3 commits into
developmentfrom
feat/2884

Conversation

@girishpanchal30

Copy link
Copy Markdown
Contributor

Closes #2884

Summary

Added the ability to export form submissions as CSV. The export button is now a dropdown that allows users to choose between exporting as CSV or WordPress XML (WXR).

Screenshots

image

Checklist before the final review

  • Included E2E or unit tests for the changes in this PR.
  • Visual elements are not affected by independent changes.
  • It is at least compatible with the minimum WordPress version.
  • It loads additional script in frontend only if it is required.
  • Does not impact the Core Web Vitals.
  • In case of deprecation, old blocks are safely migrated.
  • It is usable in Widgets and FSE.
  • Copy/Paste is working if the attributes are modified.
  • PR is following the best practices

@girishpanchal30
girishpanchal30 requested a review from Copilot July 21, 2026 07:46
@pirate-bot pirate-bot added the pr-checklist-complete The Pull Request checklist is complete. (automatic label) label Jul 21, 2026
@pirate-bot

pirate-bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Bundle Size Diff

Package Old Size New Size Diff
Animations 178.33 KB 178.33 KB 0 B (0.00%)
Blocks 1.65 MB 1.65 MB 0 B (0.00%)
CSS 7.83 KB 7.83 KB 0 B (0.00%)
Dashboard 172.49 KB 172.49 KB 0 B (0.00%)
Onboarding 68.14 KB 68.14 KB 0 B (0.00%)
Export Import 4.73 KB 4.73 KB 0 B (0.00%)
Pro 439.82 KB 439.82 KB 0 B (0.00%)

@pirate-bot

pirate-bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Plugin build for ad6e823 is ready 🛎️!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds spreadsheet-friendly CSV exports for stored form submissions while preserving the existing WordPress XML format.

Changes:

  • Adds CSV generation and format selection.
  • Introduces an export-format dropdown.
  • Adds PHP and E2E export tests.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
inc/plugins/class-form-records-export.php Implements XML/CSV export handling.
inc/plugins/class-dashboard.php Adds format selection and download behavior.
tests/test-form-submissions.php Tests XML defaults and CSV content.
src/blocks/test/e2e/blocks/form.spec.js Tests XML and CSV downloads.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread inc/plugins/class-form-records-export.php Outdated
Comment thread inc/plugins/class-form-records-export.php Outdated
Comment thread inc/plugins/class-form-records-export.php Outdated
array(
'post_type' => Form_Submissions::FORM_RECORD_TYPE,
'post_status' => array( 'draft', 'unread', 'read', 'trash' ),
'posts_per_page' => -1,
Comment thread inc/plugins/class-dashboard.php Outdated
@Soare-Robert-Daniel

Copy link
Copy Markdown
Contributor

@girishpanchal30 can you post an output example for this based on submissions on 3 forms?

One of the problem of the CSV export to be used in Excel or similar is that, based on the number of forms, the export will contain lots of columns. If the user use one or two forms, the output should be decent.

@pirate-bot

pirate-bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

E2E Tests

Playwright Test Status: See serial and parallel matrix jobs

Performance Results serverResponse: {"q25":458,"q50":478,"q75":480.7,"cnt":10}, firstPaint: {"q25":1565,"q50":1692.4,"q75":1799.7,"cnt":10}, domContentLoaded: {"q25":3813.2,"q50":3891.8,"q75":3950.6,"cnt":10}, loaded: {"q25":3815.1,"q50":3893.5,"q75":3952.8,"cnt":10}, firstContentfulPaint: {"q25":4377.5,"q50":4437.75,"q75":4500.1,"cnt":10}, firstBlock: {"q25":15540,"q50":15643.9,"q75":15861.7,"cnt":10}, type: {"q25":27.57,"q50":31.2,"q75":33.84,"cnt":10}, typeWithoutInspector: {"q25":24.43,"q50":25.98,"q75":27.35,"cnt":10}, typeWithTopToolbar: {"q25":38.23,"q50":39.38,"q75":40.66,"cnt":10}, typeContainer: {"q25":18.37,"q50":19.23,"q75":21.8,"cnt":10}, focus: {"q25":149.86,"q50":159.4,"q75":163.79,"cnt":10}, inserterOpen: {"q25":45.03,"q50":47.12,"q75":52.22,"cnt":10}, inserterSearch: {"q25":18.05,"q50":19.59,"q75":21.86,"cnt":10}, inserterHover: {"q25":5.63,"q50":5.81,"q75":6.62,"cnt":20}, loadPatterns: {"q25":1877.76,"q50":1900.63,"q75":1909.84,"cnt":10}, listViewOpen: {"q25":253.14,"q50":275.16,"q75":283.32,"cnt":10}

@girishpanchal30

girishpanchal30 commented Jul 21, 2026

Copy link
Copy Markdown
Contributor Author

@Soare-Robert-Daniel, I have attached the exported CSV. Currently, the standard columns are fixed, and the remaining columns are generated dynamically based on the fields added to the form.

otter_form_submissions__2026-07-21.csv

CleanShot 2026-07-21 at 11 50 33@2x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-checklist-complete The Pull Request checklist is complete. (automatic label)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants