The Table View to CSV Converter plugin allows you to export table Views as a CSV file (comma-separated values) on the front-end of your site.
A CSV file can be read by spreadsheet programs like Microsoft Excel, Apple Numbers, Google Sheets, and those that can read text files like Notepad++.
Exporting Views to CSV brings the full power of Views, with their sophisticated filtering system and flexibility, to exporting Formidable entries. You can customize the content with inline conditional statements, shortcodes, custom text, and anything else you can put in a View.
With this add-on, you can:
- allow your users to export their own data
- create a search form of your products and let people export their results
- give admins robust filtering options to export entries with customized content
- do a daily backup of the entries of your critical forms
There are several ways to export table Views as a CSV file on the front-end:
Download and Setup
- If you haven't already done so, install and activate Formidable Forms Pro.
- In your WordPress admin, go to Formidable → Add-Ons and click the Install button for the Table View to CSV Converter plugin.
- Create a Table View for your form. Your View must have the markup for an HTML table (<table>) in the Before Content box in order to be exportable.
- Select All Entries or Both (Dynamic) for the View Format.
- Choose how you want to export the CSV file for the table View. You can add an export link below a View, use the shortcode, or schedule automatic exports.
Add export link to download
To generate an export link for a user to download the table View as a CSV file, follow the steps below.
- In the View settings, scroll down to the Export View Settings section.
- Select the Show Export Link with View checkbox.
- If you would like a custom filename, fill in the Filename box. If you don't enter anything in this box, the title of the View will be used. By default, the filename will also include a number representing the date. This allows a person to export the same View multiple times into separate files instead of overwriting the same file each time.
- The Export Link Text is the label on the export link. Customize the link text to something like "Download your results" or "Export your entries". Otherwise, the link will use the text "Export to CSV".
- If your view includes filters that get values from the URL, you can decide whether to include the URL parameters for the export. You have two options
- Yes (more flexible, not recommended for Views with sensitive data) - If selected, URL parameters will be available for the export to filtering and display. Including params is not recommended for Views with sensitive data as these params can be seen and changed easily using browser tools.
- No (more secure) - Selected by default. This option is more secure. Depending on the filters in your View, the export may include different data.
- Preview your View. You should now see an export link to download the CSV file.
Use the shortcode
The [frm-export-view] shortcode allows you to create a link to download a table View to a CSV file.
Insert the [frm-export-view view=100] shortcode on a page, post, View, email message or any other location where WordPress shortcodes are processed.
- view: The id or key of the View that will be exported as a CSV file.
Change 100 to the id or key of the View you want users to be able to export.
- label: The text of the link to export the CSV. If a value isn't entered, the Export Link Text setting from the View will be used. If no value has been set, "Export to CSV" will used.
[frm-export-view view=100 label="Download my book recommendations"]
Schedule automatic exports
You can automatically export a table View as a CSV file. The location on your server, and frequency of the export is up to you.
- Go to your Formidable → Global settings → Export Views page.
- Schedule CSV Export: Select the View(s) that you would like to export.
- Frequency: Choose when you want to schedule the export by days or months, then enter the number. Note: Months are at thirty-day intervals and not calendar months.
- Format: Choose the format for your CSV file. UTF-8 is the default format. If special characters in your export are not appearing correctly, try a different formatting option.
- Column separation: Enter a single character to use as a separator in your export. By default, a comma will be used.
- Destination directory path: Enter the path to a folder on your server to store the exports. Include the root, which is listed beneath the setting for your convenience. If you don't add a location, the default wp-content/uploads/formidable/exports folder will be created automatically. The default location is an excellent place to save your exports.
Disable Automatic exports
To stop automatic exports of the Table Views, follow the steps below.
- Go to your Formidable → Global settings → Export Views page.
- In Schedule CSV Export, uncheck the Views you no longer want to automatically export. Uncheck all to stop all automatic exports.
- Click Update.
Exporting with parameters
Params can expand what you can do with Views. They can be used to display and filter the view content. Depending on your view filters, if params are changed or removed, people may potentially see data they shouldn't.
The Table View to CSV Converter plugin gives you the choice of how you would like to work with parameters. Below are the following options.
- Choose not to export with params
- In the View Export settings → Include params with your CSV export setting, select No. With this option selected, parameters are not added to the link to export the View.
- Choose to export with params
- In the View Export settings → Include params with your CSV export setting, select Yes. With this option selected, params from all sources are added to the link.
- Export some params but not others
- In the View Export settings → Include params with your CSV export setting, select Yes.
- In the After Content box of the View (after the closing table tags), set the values of the params you don't want to be added to an empty string with [frm-set-get]. e.g. [frm-set-get color=""]
Params included with export
You can set parameter values in different ways:
- In the URL:
- In form and View shortcodes displayed above the export View link:
[frm-display-data id=100 color=red]
- Using [frm-set-get]:
If you choose to export with params, all params will be shown in the export link. This will include those in the URL, the [frm-set-get] shortcode, and form and View shortcodes.
It's relatively easy for someone who knows how to use browser developer tools to see, save, and change the link used to export a View. The key data in the export link is obfuscated to make it difficult to change the link and export different data.
Change link expiration time
Links for logged-in users and visitors who aren't logged in are handled a bit differently. Both can only be used for a limited time. If you want to change the time for visitors who aren’t logged in, use the frm-export-view-link-expiration-hours hook.
Invalidate all links
You can invalidate all links by changing your site salts in the wp-config.php. Learn how to change WordPress Salt Keys. Any saved export links will no longer work.
Create admin dashboard for exporting
Formidable has built-in CSV exports of entries in the admin area. When exporting a CSV via a table View, you can create an admin dashboard with robust filtering that's tailored to your needs and preferences. To create an enhanced admin dashboard to export your entries, follow the instructions below.
- Create a Table View for your form.
- Create a custom search form to filter your View as needed.
- Make sure that your View's visibility is set to private. This setting can be found on the right sidebar of your View builder.
- Add the search form and View shortcodes on a page on your site.
- Use the free Hide This plugin or frm-condition with the has_role shortcode to only show the search form and search results View to admins.
No Views available for export
The Table View to CSV Converter add-on will evaluate whether a View can be exported or not when the View is saved. If your table View was created before you activated the add-on, go to the View builder and saving the View again.
No export link
If the View with any allowed parameters has no entries, the [frm-export-view] shortcode will not show an export link.
No CSV file created
If you have set up an automatic export but you're not seeing any CSV files in your directory, try looking in your wp-content/uploads/formidable/exports directory. This is the default location for files to be saved. If there are any issues with the destination directory path you selected, your exports will be saved in the default location.
Make sure your table View has entries. If the table View doesn't have entries, a CSV file won't be created.
If your CSV export is missing content from the downloaded Table View, here are a few things to check:
- Do you have any stray content that's outside of td or th tags? Only content that is inside the td or th tags, which are inside tr tags, will be included.
- Have you formatted your table rows and cells properly? If not, their content won't be included.
- HTML markup, links and images can't be included in the content. If you want to save an image link, show the link on its own in the View instead of inside an img tag.