How to export Wufoo submissions from ALL forms

Wufoo Site header with buttons and the Wufoo dinosaur.

Today, I was asked to support a marketing effort by exporting all the email addresses of registrants for a client who had 99 forms on Wufoo. The problem with this, was that Wufoo does not offer bulk form export. This means I would have had to go through each and every form and manually export. Not only is this a major chore, but it would have been susceptible to user error (By form #11, I would be asking myself, "Did I export form #10 or did I accidentally skip it?") I tried to save myself the trouble, at first, by emailing Wufoo support and asking if they could bulk export them for me (after all, they have direct access to the database). Unfortunately, they replied that, while bulk exports are a great idea, they do not offer that service. I even asked them to name their price! No dice.

Luckily, I noticed that Wufoo DOES feature a rich API, and language wrappers. After downloading the PHP wrapper and exploring the API, I located the API calls I needed! I then grabbed the credentials I needed from Wufoo for the WufooAPIWrapper constructor. I then called getForms() to pull all of the forms on the account, and set up a loop. Within the loop, I pulled all of the submissions for each form with getEntries(), and saved it to a CSV file locally. I borrowed an array-to-CSV converter script from (Thanks, Ashley Ford!), and modified it to save my CSVs locally instead of downloading them (I had 99 forms, many of which had different field counts/order, so aggregating them into one CSV wasn't possible).

See below for the code I used.

*Note that the export I set up pulls ALL fields, and they're not labeled with descriptive column names. To scrape the email addresses post-export, I googled for a script and happily, one was available! Thanks, Dhawal D of The DNetWorks! You can view his blog post about how to use Mac Automator to quickly & easily scrape email addresses from a folder, here. I set up an automator application to scrape all the email addresses from the 99 CSVs that were created by my export.

  foreach($forms as $form) {
    $submissions = $wf->getEntries($form->Hash);
    if($submissions) {
      $filename = 'exports/' . $form->Hash . '.csv';
      convert_to_csv($submissions, $filename, ','); 
      echo '

' . $form->Name . ' entries exported to ' . $filename . '

'; } else { echo '

' . $form->Name . ' has no entries.

'; } } // borrowed from and heavily modified function convert_to_csv($input_array, $output_file_name, $delimiter) { $f = fopen($output_file_name, 'w'); foreach ($input_array as $line) fputcsv($f, (array) $line, $delimiter); fseek($f, 0); fpassthru($f); }