Google Docs includes a great tool for customer feedback, survey’s and request forms in the Google Forms functionality. When data is submitted into the form, a new row of results is added to the corresponding Google Spreadsheet.

The default functionality of Google Forms allows for aggregated data and statistical data. My requirement was to be emailed the results of each submission to the form as they happened.

By adding the following code to your Google Spreadsheet, you can send each submission to an email.

  1. function emailFormSubmission() {
  2.   var theFormSheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
  4.   // Update these to reflect your requirements
  5.   var theEmail = "";
  6.   var theSubject = "Form Responses";
  8.   var theQuestions = theFormSheet.getRange(1, 1, 1,theFormSheet.getLastColumn()).getValues();
  9.   var theForm = theFormSheet.getRange(theFormSheet.getLastRow(), 1, 1,theFormSheet.getLastColumn()).getValues();
  10.   var theBody = ‘<table id="answers"><tr><th>Question</th><th>Answer</th></tr>’;
  12.   for (var i = 0; i< theForm[0].length; i++)
  13.   {
  14.     if (theForm[0][i]!="")
  15.     {
  16.       theBody += ‘<tr><td>’+theQuestions[0][i]+"</td><td>"+theForm[0][i]+"</td></tr>";
  17.     }
  18.   }
  19.   theBody += ‘</table>’;
  21.   MailApp.sendEmail(theEmail, theSubject, "",{htmlBody: theBody});
  22. }

Once you’ve added this code to your spreadsheet, just set the trigger to run on form submission and each time a new form is submitted an email will be sent with the contents of the form. This method maintains the order of the questions asked, and only shows the questions which have been answered.

Here is a link to an example Google Spreadsheet which includes the code/form.
Send Google Form data as an Email on submission

Hope it helps, feel free to drop a comment with any suggestions/questions.