I'd like to get the submission information from Webform, I checked the API but it's can't get me the data I need. The main goal would be to get every submission in a xml/json/array so I could get work done with the data. Anyone done this before?

Also I'd like to point out that I know I could read it out of the database directly, but it would look definitely nicer with API if it can be done with it.

  • Would you mind if the data was exported as Excel format?
    – N dube
    Commented Feb 16, 2012 at 10:31
  • It's not about exporting data, but working with it realtime in another module :)
    – Tusk
    Commented Feb 16, 2012 at 11:43
  • Ahh i see okay. well im sure you have seen the results section of the webform node which is clearly what you're not looking for :p
    – N dube
    Commented Feb 16, 2012 at 11:52

3 Answers 3


Can't you just intercept the submission by a adding a a custom submit function with hook_form_alter, a la $form['#submit'][] = 'yourModule_yourForm_submit'; ? Here I add it to the end of the submit functions array, but you can also put it first with array_unshift. There you can grab the values before they go in the db and do as you please with them.


There's a module webform_mysql_views that exposes webform submissions to mysql views and combined with the data module you can expose them to views.

Als have a look at #680386: Views integration for the webform_submitted_data table

  • webform_mysql_views module is only for 6.x not for 7.x :(
    – Tusk
    Commented Feb 16, 2012 at 11:44
  • Put the port is almost complete, see Webform MySQL Views for Drupal 7
    – Attiks
    Commented Feb 16, 2012 at 19:31

The function you need is webform_get_submissions. Here is a sample usage:

$submissions = @webform_get_submissions(array('nid'=>97));
foreach ($submissions as $submission {

(Obviously, this is only for test and works if you have the Devel installed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.