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.

Export Data in TSV or tab-delimited file

  1. phaines@touchpointstrategies.n
    Member

    My client needs to receive the enrollment data from our gravityforms in TSV or tab-delimited files. Is this possible with gravity forms?

    Posted 13 years ago on Thursday November 3, 2011 | Permalink
  2. Yup!

    http://pastie.org/2805483

    That'd go right in your theme's functions.php file.

    Posted 13 years ago on Thursday November 3, 2011 | Permalink
  3. This doesn't seem to be working for me...maybe I have the wrong idea here?
    We have a client that needs to export the entries from a registration form into a tab-delimited text file. Its looking like this doesn't transform it into a csv file? I have seen (not tested) converters out there that transform a .csv into a tab-delimited text file, but the clients needs something more automated. Anyone have any helps/thoughts?

    BTW thanks so much for posting this David!

    Posted 13 years ago on Monday November 14, 2011 | Permalink
  4. What happens when you try this? The code provided by David is designed to replace the comma with a tab character in the export file. Sounds like that's what you're trying to do.

    This hook was added in 1.6 What version of the plugin are you using?

    Posted 13 years ago on Tuesday November 15, 2011 | Permalink
  5. Thanks so much for the help! The problem was indeed my plugin version. I should have checked that first. I updated and we are good to go. It looks like now instead of separate data cells in the .csv file each piece of input info is wrapped around "" and all in one data cell. This seems to but what the clients needs except for one last piece. The sample file they sent us is a text file. So now somehow we need the export file as a .txt not a .csv. Here is an example of the data they sent us (which again is saved in a text file) - names and address replaced obvioulsy :)

    2008-07-25 00:12:44.000~Lizzy~~GOZ~~219 N AM AVE~TUCSON~AZ~85745~~10 ~19991031~D000000000~F~I|
    2008-07-25 00:12:44.000~Lou~~GO~~230 N FM AVE~TUCSON~AZ~85745~~10 ~19991031~D000000000~F~I|
    2008-07-25 00:12:44.000~Phil~~John~~200 N AM AVE~TUCSON~AZ~85745~~10 ~19991031~D000000000~F~I|
    Posted 13 years ago on Wednesday November 16, 2011 | Permalink
  6. So you do not need CSV or TSV? You need plain text?

    Can you post the exact format you need, at pastebin.com or pastie.org, so the formatting will be preserved? It looks like this is the format that is required for your export? And instead of a comma or tab, you need a ~? If so, instead of the "\t" in the code from David Smith, you can use "~" there.

    ~

    Does that resolve the issue?

    Posted 13 years ago on Thursday November 17, 2011 | Permalink
  7. Thanks so much for the help.....yes I need a plan text file not CSV or TSV.

    Also here is the format from the sample data the client gave....
    http://pastie.org/2878949

    And here is the format that I received from a test with the code change you gave above (replacing the "\t" with "~")
    http://pastie.org/2878972

    It looks like I still getting the "" wrapped around each input? What do you think?

    Posted 13 years ago on Thursday November 17, 2011 | Permalink
  8. Could you post the exact code you are using (including the edits you have made)?

    Posted 13 years ago on Tuesday November 22, 2011 | Permalink
  9. Yes it is the same code you posted but with Chris's modification above. I have only replaced the "/t" with "`"

    http://www.pastie.org/2939668

    So again looking at the format examples I posted in my comment above I need to remove the "" wrapped around each input, and most importantly I need this to be exported as a plain text file (.txt) NOT a CSV or TSV.

    Thanks for all the help!

    Posted 12 years ago on Tuesday November 29, 2011 | Permalink
  10. The export tool produces a CSV delimited file. A CSV file is a plain text file. It just has a .CSV file extension.

    The hook only changes the separator used in the delimited CSV. It can't be used to remove the "" wrapped around each input and it can't be used to change the filename of the resulting export.

    In order to do what you want to do you'd have to manually change the data by opening it in a text editor, search and replace to remove the double quotes and then save it as a .txt file.

    Posted 12 years ago on Tuesday November 29, 2011 | Permalink
  11. Hmmm ok thanks for the help. This would definitely be good enough for me, but the client we are working with is a non-profit organization and they need to have this process automated, and are not willing to compromise on having to do the simple find and replace etc.

    So there no way to write a script or anything to transform the export file? Any other ideas on how I can achieve this?

    Thanks for the help!

    Posted 12 years ago on Tuesday November 29, 2011 | Permalink
  12. Hi fallingup,

    An automated scripted solution is possible but would require a solid grasp of PHP. Unfortunately, it isn't something we would be able to walk you through. If you are interested, a good place to start digging would be the export.php file within the Gravity Forms plugin folder.

    Good luck! :)

    Posted 12 years ago on Tuesday November 29, 2011 | Permalink