Want a more targeted, accessible way to export your WordPress site's form and table data to Excel? If you've been stuck exporting your raw form entries and removing/combining columns and/or sending the exported file over to users, this tutorial is going to make you very happy.
In this post, you'll learn how you can effortlessly export form entry data from any Formidable Forms View to Excel by just ticking a few boxes. You won't need to use complicated third-party plugins that kind of work, nor will you need to code your own solution to convert an HTML table to excel.
Better yet, you'll even be able to add a download link on the front-end of your site so that people can download their own Excel-compatible file from anywhere on your site.
Ready to learn how it works? Let's dig in...
How to Export an HTML Table to Excel With Formidable Forms
By the end of this tutorial, you'll be able to:
- Add a download link underneath any Formidable View that lets people export the HTML table to Excel.
- Use a shortcode to generate a download link for a View's data anywhere on your site, without needing to display the data in a table. For example, you can include a download link in a blog post or email.
- Automatically export any Formidable View on a custom schedule and store the exported CSV file in a custom location on your server.
To set this up, all you will need is:
Here's your step-by-step guide...
1. Create a Table View
To control what data gets exported to Excel, you can create a regular Formidable table View.
We'll assume you've already created a form with Formidable Forms that has data you want to export. If you haven't, you can follow these instructions.
To create a table View, go to Formidable → View → Add New. Then, look for the Basic Settings box and:
- Use the drop-down to select which form you want to pull data from.
- Select either All Entries or Both (Dynamic) for the View Format.
Then, to control what data appears in your View (and consequently, your Excel export file), scroll down to the Listing Page section and:
- Enter <table>in the Before Content box. You can also add a <thead> section here to add headings to your table data.
- Insert your form data in the Content box (more on this in a second).
- Enter </table> in the After Content box.
The basic format for inserting your table data in the Content box is as follows:
<tbody> <tr> <td>[6]</td> <td>[8]</td> </tr> </tbody>
Where [6] and [8] are the actual field IDs from your form. You can find these IDs in the Customization sidebar on the right, and you can add additional columns by adding another <td></td> for each column:
And with that, you've created an HTML table that will dynamically pull information from your Formidable form entries:
Now, you're ready to add the ability to export that data as an Excel file.
2. Configure Export Functionality and Add Download Link
In the same View interface that you've been working in, scroll down to the Export View Settings box and:
- Check the box to Show Export Link with View
- Enter the basic filename structure you want to use for exports (Formidable will prepend a timestamp before the filename, as well)
- Choose your Export Link Text - for example, "Export to Excel"
- Choose whether or not to include params with your export. If you're not sure, leave it as No.
You can learn more about these settings in the Table View to CSV knowledge base article.
Now, you should see a new Export to Excel link underneath your table data on the front-end (look in the bottom-left corner):
When clicked, a file download will automatically start and all the data from your View will be there when opened in Excel:
Other options to export a table to Excel
Above, you learned how to add an "Export to Excel" link underneath the full table data. But Formidable Forms also lets you add a link to export the data to Excel without forcing you to display the data in a table.
For example, you could reference it in a blog post or an email notification (as long as your email template lets you execute shortcodes).
If you'd prefer this approach, you can use the following shortcode:
[frm-export-view view=25 label="Download This Data in Excel"]
Make sure to replace the number (25) with the actual ID for your View. You can also customize the text by editing the label.
Here's an example of what it might look like:
Finally, you can also automatically export your table data on a frequency that you specify and then store the exported CSV files on your WordPress site's server. This is great for backups, daily digests, and anything else where having a "snapshot" of your data comes in handy.
To set this up, go to Formidable → Global Settings → Export View and:
- Choose the View(s) that you want to automatically export.
- Pick your export frequency, either in days or months.
- Configure basic formatting choices, like the character format and column separators.
- Enter a custom directory on your WordPress site's server (if desired).
Start exporting tables to Excel today
With Formidable Forms and the Table View to CSV Converter add-on, you can easily export tables to Excel and create a simpler workflow for yourself, members of your organization, and/or visitors to your website.
The Table View to CSV Converter add-on is available on the Formidable Forms Business plan and above. You can download the add-on from your Formidable Forms dashboard or by visiting Formidable → Add-ons in your WordPress dashboard.
If you're not on the Formidable Forms Business plan yet, check out all the helpful form builder features to learn why Formidable Forms is the best WordPress form builder plugin to have in your toolbelt.
Hi. This looks awesome. Can you please let me know whether this will work with repeater fields? In other words, how would multiple repeated fields be added to the view and export? Wouldn't they share the same field IDs for the entries?
Sorry. On further reading elsewhere, it seems I'd use the foreach shortcode. However, I still have a question please. What I'm keen to do is use a single form submission, with multiple repeater sections across a number of topics, to produce a risk matrix from the parent form submission. I'd like to be able to show that submission as a single entry view, with each child submission populating a new row in a table. I'd then like to be able to export that view to CSV/Excel, so that when the file is opened in Excel, the child entries all appear in their own rows. Is that possible please? Thanks.