November 16th, 2015: Updated to work with current version of Gravity Forms.
August 8th, 2015: Updated to work with Gravity Forms 2.0+
@bamadesigner asked:
Is there a way to export lead checkbox values from @gravityforms into one column as a CSV instead of a column for each checkbox? #WordPress
— Rachel Carden (@bamadesigner) August 2, 2015
I cooked up a quick snippet (using the gform_export_fields filter) to allow you to not only export checkboxes but all multi-input fields in a single column.
What are multi-input fields? They’re fields like the Checkbox field, Name Field, Address field, Multi Select field, etc. Out of the box, Gravity Forms allows you export the individual inputs of these fields in separate column but not all of the inputs in a single column.
Use this snippet to automatically add a “top level” option that will export all inputs for this field in a single column.
How do I install this?
- Click the “Download Plugin” button at the top of this page.
- Upload the downloaded plugin zip file via your WordPress admin (full instructions).
Did this resource help you do something awesome with Gravity Forms?
Then you'll absolutely love Gravity Perks; a suite of 46+ essential add-ons for Gravity Forms with support you can count on.
I’m running into an issue with this snippet trigger an AJAX admin php error when trying to export data from a form with credit card fields. Running latest version on PHP 8.0. Error log says: [08-May-2023 18:39:42 UTC] PHP Warning: Trying to access array offset on value of type null in /home/public_html/wp-content/plugins/gravityforms/includes/fields/class-gf-field-creditcard.php on line 604 [08-May-2023 18:39:42 UTC] PHP Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /home/public_html/wp-content/plugins/gravityforms/includes/fields/class-gf-field-creditcard.php:607 Stack trace:
0 /home/public_html/wp-content/plugins/gravityforms/includes/fields/class-gf-field-creditcard.php(596): GF_Field_CreditCard->maybe_upgrade_inputs()
1 /home/public_html/wp-content/plugins/gravityforms/forms_model.php(1117): GF_Field_CreditCard->post_convert_field()
2 /home/public_html/wp-content/plugins/gravityforms/export.php(1132): GFFormsModel::convert_field_objects(Array)
3 /home/public_html/wp-content/plugins/gravityforms/gravityforms.php(4525): GFExport::add_default_export_fields(Array)
4 /home/public_html/wp-includes/class-wp-hook.php(308): GFForms::select_export_form(”)
5 /home/public_html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters(”, Array)
6 /home/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
7 /home/public_html/wp-admin/admin-ajax.php(188): do_action(‘wp_ajax_rg_sele…’)
8 {main}
thrown in /home/public_html/wp-content/plugins/gravityforms/includes/fields/class-gf-field-creditcard.php on line 607
Hi Josh, when testing localy this seems to work as expected. It will require some digging on your setup to understand what could be going on. You can contact us via our support form so we can get more information about your use case if you have an Advanced or Pro license.
Do you need to also be subscribed to Gravity Wiz for this to work? Or is this a standalone plugin? I downloaded it and it still isn’t exporting correctly. Do I also need to add the code to the website, or is installing the plugin enough? Thank you!
Hi Steve,
This is a free standalone plugin. No Gravity Wiz subscription required!
After installing and activating the plugin, a new option for exporting checkbox fields is available in the entries export. Instead of selecting the individual choices in the export, only check the checkbox field’s name to export the values into a single column.
Hello! can we use the snippet as is or do we need to edit the array fields?
Hi Annabelle,
It should work as is! If you have an active Gravity Perks Advanced or Pro license, you can contact us via our support form to help you setting it up.
Best,
We had trouble with this as it was doubling up date fields, which have multiple inputs but already export as 1 column. Simple change to Line 32
https://snippi.com/s/kchtuyn
Cheers
Hi Mike,
Thanks for the feedback and for sharing the code, but unfortunately, I haven’t been able to recreate the issue. Can you please provide us with more information on the issue? How exactly is the snippet doubling up the Date fields?
Best,
Hi,
Does this snippet work with List fields? It does seem to work well with address, and checkbox fields.
Thanks Shawn
Hey David,
Do you know if this still works with the latest version of GF? I’ve tried adding the code to our child themes functions.php file, and also tried the plugin. Neither option works. Your old screenshots no longer work so I can’t see where to check for a new field etc. Could you please add screenshots to the article?
Thank you
Hi Shaun,
I just did a test and I can confirm the snippet still works. After adding the snippet to the function.php file, you should see a top-level option that similar to the screenshot here, In that screenshot, the multi-input field is a checkbox field and the checkbox field has been made available by the snippet for selection to export all the choices selected for that field in a single column.
I hope this helps.
Best,