PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Commas in export data

  1. haylc
    Member

    Hi,

    I've just started creating my first form, and I've noticed that if I include a comma in the field label, the csv export data gets all messed up. The question gets broken at the comma, but the responses keep filling every column in the csv file, so the responses end up in all the wrong columns. It would be great to have the columns separated by something other than a comma, or to somehow escape the question with quotation marks etc.

    I've had a little look on the forums and it looks like the same thing can happen if users include commas in their responses? I'm only just starting out with Gravity Forms so I haven't come across this second problem yet, but I imagine it might be a similar cause/fix. I'm a little confused about the various conversations shared on the forums, so I'm just wondering if you can please share the best way to fix this? I'd rather not have to edit the plugin files, but happy to with a little guidance!

    Thanks for your help.

    Posted 13 years ago on Friday June 1, 2012 | Permalink
  2. Hi. You can use the gform_export_separator filter to use a field separator other than a comma (anything not in your data.) The example on this page shows using a pipe character.

    http://www.gravityhelp.com/documentation/page/Gform_export_separator

    Let us know if you need help implementing this. The code will be added to your theme's functions.php

    Posted 13 years ago on Friday June 1, 2012 | Permalink
  3. haylc
    Member

    Hi,

    Thanks for the response, although I think I may need some more help here. I've copied and pasted the example code from your link, and now my csv data looks even more strange. It's still separating at the commas, but ONLY at the commas now. Other than the commas, the questions and results are all compressed in a single column, with the pipe and its quotation marks "|" displayed in the cell. Have I done something wrong? I've just copied and pasted the code exactly into functions.php. Happy to email you the csv file if it helps explain things.

    Thanks.

    Posted 13 years ago on Friday June 1, 2012 | Permalink
  4. Can you post your functions.php file to pastie.org or pastebin.com so we can take a look? Thanks

    Posted 13 years ago on Friday June 1, 2012 | Permalink
  5. I suspect though that whatever program you are using to open it needs to be told that the pipe is the field delimiter now, not the comma. In OpenOffice Calc, it looks like this http://minus.com/mfF7eoPoD/

    Uncheck the "Comma" box and check "Other" with your new field delimiter, a pipe in the example I linked to.

    Posted 13 years ago on Friday June 1, 2012 | Permalink
  6. haylc
    Member

    Pasted at http://pastebin.com/8Ei4EzRt

    Thanks

    Posted 13 years ago on Friday June 1, 2012 | Permalink
  7. haylc
    Member

    OK so it works if I tell the program to use a pipe as the delimiter. My problem is that there are about six different admins who will all be exporting form data, and I know this will end up causing a lot of confusion. If I set the delimiter to a semicolon (or a tab, if that's possible?) rather than a pipe, do you know if Excel, OpenOffice Calc etc will recognise that by default, without having to change it in the program settings?

    Thanks heaps.

    Posted 13 years ago on Friday June 1, 2012 | Permalink
  8. David Peralty

    The only way to know if any of those programs will open it by default is to test it or search Google to make sure. I definitely don't know off hand if Excel, OpenOffice or LibreOffice will open a semicolon as a delimiter by default.

    Posted 13 years ago on Friday June 1, 2012 | Permalink