How do I export multi-input fields in a single column with Gravity Forms?

August 8th, 2015: Updated to work with Gravity Forms 2.0+

November 16th, 2015: Updated to work with current version of Gravity Forms.

@bamadesigner asked:

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?

  1. Click the “Download Plugin” button at the top of this page.
  2. Upload the downloaded plugin zip file via your WordPress admin (full instructions).

Comments

  1. Josh
    Josh May 8, 2023 at 3:00 pm

    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

    Reply
    1. Dario
      Dario Staff May 8, 2023 at 3:47 pm

      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.

  2. Steve
    Steve February 3, 2023 at 4:36 pm

    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!

    Reply
    1. Scott Ryer
      Scott Ryer Staff February 3, 2023 at 5:41 pm

      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.

    1. Dario
      Dario Staff February 3, 2023 at 10:18 am

      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,

    1. Samuel Bassah
      Samuel Bassah Staff September 14, 2022 at 7:37 am

      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,

  3. Shawn Postma
    Shawn Postma January 13, 2021 at 8:04 am

    Hi,

    Does this snippet work with List fields? It does seem to work well with address, and checkbox fields.

    Thanks Shawn

    Reply
  4. Shaun
    Shaun October 22, 2020 at 1:35 am

    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

    Reply
    1. Samuel Bassah
      Samuel Bassah Staff October 22, 2020 at 9:45 am

      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,

  5. CHARLOTTE A MCRANIE
    CHARLOTTE A MCRANIE May 31, 2019 at 1:50 am

    You mentioned as examples Name and address fields. I don’t consider those multi fields that need to be exported to the same column. I want those exported to single columns for sorting and filtering purposes in my database. But I do want checkbox fields exported to a single column. From what you described above it sounds like this snippet would also lump together all of the components of the address field and all of the components of the name field. Is that correct?

    Reply
    1. David Smith
      David Smith Staff May 31, 2019 at 8:04 am

      Hi Charlotte, this doesn’t remove anything, it only adds a combined option. You can still target the individual fields for the Name and Address field. And you can select the combined option for the Checkbox field.

  6. Harald Oestreicher
    Harald Oestreicher January 13, 2019 at 2:42 pm

    Hey David,

    thanks for this. I need to export the consolidated column values with a semicolon as separator. So instead of “car, mouse, hat” I need “car; mouse; hat” in the CSV export. Any simple way to do that? I tried for hours, but I’m stuck :(

    Reply
  7. Pete Wilson
    Pete Wilson March 9, 2018 at 9:05 am

    Hi David- found a peculiarity – i’m using this with the Gravity forms + custom Post types plugin and mapping a checkbox field to a taxonomy. if you do this, it works inasmuch as it exports the FIRST item but it doesn’t export subsequent items if you have selected multiple values… latest version of WP, gravity forms, and the GF+custom post types plugin, and latest version of this snippet downloaded today.

    Reply
  8. Philipp
    Philipp March 1, 2018 at 10:33 am

    In the current form, the plugin will “prepend” the consolidated inputs. The original cells (one for each possible answer) are still included in the export. To prevent this. simply remove lines 33 and 36.

    Reply
  9. gform_export_fields – Gravity Forms Documentation October 5, 2017 at 4:48 pm

    […] tutorial (by Gravity Wiz) adds a choice for each multi-input field allowing the field to be exported as a single […]

    Reply
  10. L
    L March 4, 2017 at 11:41 pm

    Hi David, thanks for developing this plugin! It seems like such an odd flaw in the thinking for Gravity Forms.

    I’ve installed the plugin, but there’s no change on my site to the export options or to the exported spreadsheet. Am I missing something?

    Thanks, L

    Reply
    1. David Smith
      David Smith Staff March 5, 2017 at 6:49 am

      Hi L, can you send me a screenshot of your export screen (not the export itself) with the plugin inactive and another with the plugin active?

  11. Janna
    Janna January 24, 2017 at 3:06 pm

    I’m having the same problem Courtney outlined:

    “I downloaded/installed the plugin – and activated it. Now what? I don’t see any new export options, and my export looks exactly like it did before the plugin. Am I missing something?”

    My Gravity forms is version 2.1.2 and wordpress is 4.7.1

    Reply
  12. Courtney
    Courtney January 23, 2017 at 4:14 pm

    I have the same question / experience as Amy from earlier last year:

    “I downloaded the plugin – and activated it. Now what? I don’t see any new export options, and my export looks exactly like it did before the plugin. Am I missing something?”

    Reply
    1. David Smith
      David Smith Staff January 23, 2017 at 7:57 pm

      Hi Courtney, are you running the latest version of Gravity Forms? If yes, could you send me a screenshot of your export screen before and after activation?

  13. Tim Corbin
    Tim Corbin November 30, 2016 at 8:11 pm

    I’d love to be able to do the opposite of this. For example, the List field exports all field columns into a single column, but I’d like to have each field column be its own exported column (like the Name field or Address field does). Any chance this is possible?

    Reply
  14. Paul
    Paul September 6, 2016 at 1:52 pm

    Hello David,

    This isn’t working for me the way it should. I have the custom field name showing up for the multi-select field 4 times (once for each selectable item [4 items total]), instead of all those selections being aggregated into a single column. Any ideas?

    Reply
  15. Corey
    Corey August 3, 2016 at 1:16 pm

    After upgrading Gravity Forms to version 2.0.4.x, I’ve found that the all the cells for a multi-select checkbox field are appearing empty. The headers come in okay, but there are no values.

    Any thoughts?

    Reply
  16. CR
    CR July 19, 2016 at 10:30 am

    This isn’t working for me either. The columns are not consolidated when I use the export tool and the field is blank when I export.

    I would assume the plugin would combine the selections into a single field separated by commas, but no luck.

    I am fully updated on WP core and all plugins (including Perks and Gravity Forms).

    Reply
    1. David Smith
      David Smith Staff August 8, 2016 at 2:26 pm

      This snippet has been updated to work with Gravity Forms 2.0+. Give the updated version a try (above).

  17. Adam
    Adam July 4, 2016 at 8:37 pm

    Hi David,

    Does it work with the current version of GravityForms? I am running 1.9.19 and when I activate it nothing shows up. I looked at your screenshots and don’t see those options.

    Thank you

    Reply
    1. David Smith
      David Smith Staff July 14, 2016 at 7:57 pm

      Hi Adam, I’ve just tested with the latest version of Gravity Forms (2.0.2.x) and this is working for me.

  18. Casey
    Casey May 16, 2016 at 8:39 am

    Hello, David. Is it possible to go into your code and choose which multi-select questions get compiled into a single cell?

    Reply
  19. Lisa
    Lisa March 15, 2016 at 3:31 pm

    The screen capture links you put in your reply to Amy aren’t working. I installed the plug-in, but do not see any changes.

    Reply
  20. Amy Clubb
    Amy Clubb March 4, 2016 at 3:29 pm

    I downloaded the plugin – and activated it. Now what? I don’t see any new export options, and my export looks exactly like it did before the plugin. Am I missing something?

    Reply
  21. Sean
    Sean November 11, 2015 at 9:47 am

    Hi David. I was referred here by Gravity Forms when I had asked them how to do this. I tried installing the snippet and the Checkbox fields are showing up on the Export Entries page, and are being exported into a single column. However, all of the cells (other than the header) for the column are empty. Any suggestions? I’ve watched the video and also tried installing the snippet directly into my functions.php file but the issue persisted. I tried exporting only the Checkbox field as well as the Checkbox field and the individual options for that field, but in both cases, all entry rows for the Checkbox field and its options are blank (all other fields display their respective data in the csv).

    Your snippet is the only code in my functions.php file other than my theme’s code to enqueue the css. Is Gravity Perks required to have this snippet export the data into the respective entries in the Checkbox column? Thank you.

    Reply
    1. David Smith
      David Smith Staff November 16, 2015 at 9:41 am

      Hi Sean, it looks like there was a conflict introduced in the current version of Gravity Forms. I’ve updated the snippet. You can re-download above. :)

  22. Edney Samuels
    Edney Samuels October 5, 2015 at 10:24 pm

    i cant get it work. Got this fatal error

    Parse error: syntax error, unexpected T_FUNCTION in /home2/ccmjmco/public_html/wp-content/plugins/gw-gravity/gw-gravity-forms-export-multi-input-fields-single-colum.php on line 22

    Reply
    1. David Smith
      David Smith Staff September 1, 2015 at 2:28 pm

      Hi Christine, if it proves to be a popular snippet, there is a good chance it will be converted to a perk. :)

Leave a Reply

Your email address will not be published. Required fields are marked *

  • Trouble installing this snippet? See our troubleshooting tips.
  • Need to include code? Create a gist and link to it in your comment.
  • Reporting a bug? Provide a URL where this issue can be recreated.

By commenting, I understand that I may receive emails related to Gravity Wiz and can unsubscribe at any time.

Grab a bundle of free Gravity Forms plugins

Enter your email and receive our most popular free plugins and snippets, plus access to hundreds of others.

This field is for validation purposes and should be left unchanged.