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 47+ essential add-ons for Gravity Forms with support you can count on.
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?
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.
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 :(
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.
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.
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
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?
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
Hi Janna, see my response to Courtney.
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?”
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?
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?
Hi Tim, possible but not without a decent bit of coding. If this is something you want to commission, we can help.
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?
Can you send me an export of your form?
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?
Hi Corey, just updated this snippet to address this issue. Give it a try.
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).
This snippet has been updated to work with Gravity Forms 2.0+. Give the updated version a try (above).
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
Hi Adam, I’ve just tested with the latest version of Gravity Forms (2.0.2.x) and this is working for me.
Hello, David. Is it possible to go into your code and choose which multi-select questions get compiled into a single cell?
Hi Casey, this is not readily possible.
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.
Try those links again now, they’re working for me.
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?
Hi Amy, given a multi-input field (like a Checkbox field), you would see this if you attempt to export the entries without the plugin (screenshot) and you would see this with the plugin (screenshot).
Thank you very much David! Works great now :)
Awesome! Glad to hear it.
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.
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. :)
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
Hi Edney, try the tips in this article as a starting point: https://gravitywiz.com/documentation/snippet-troubleshooting/
Are you integrating this into Gravity Perks?
Hi Christine, if it proves to be a popular snippet, there is a good chance it will be converted to a perk. :)