[GUIDE] Adding Email Notifications to Google Forms

Friday, March 14, 2014 @ 3:46 am

Google Forms is an incredibly fast and simple way to gather feedback from people on various topics. By default, it is not able to email you/the respondent with submitted form details. In this guide, I walk you through on how to set up email notifications.

  1. Go to Google Drive: https://drive.google.com/?tab=mo&authuser=0#my-drive
  2. Click on Create, then Form:
    Create a Form
  3. Enter a form name and select a form theme:
    Configuring the Form
  4. Add a Text Field to capture the user’s email address, and set it as required:
    Adding a Text Field
    Configure Text Fiel
  5. Create other form fields if needed.
  6. Click on Choose response destination in the toolbar:
    Response Destination
  7. Ensure it’s set to New spreadsheet, then click on Create:
    Setting Response Destination
  8. Click on Responses, then View Responses
    View Responses
  9. This will open the Google Spreadsheet that will contain form submitted data (we will refer to this step in step #14):
    Spreadsheet Columns
  10. Click on Tools, and Script Editor:
    Script Editor
  11. In the prompt, click on Blank Project:Project Type
  12. Copy and paste the following code into the textarea:

    function sendFormByEmail(e) {
    var s = SpreadsheetApp.getActiveSheet();
    var headers = s.getRange(1,1,1,s.getLastColumn()).getValues()[0];
    var email = “”;
    var message = “”;
    var subject = “[GFORMS] Submission from “;// Method A – Include all columns in spreadsheet
    // Loop through the array and append values to the body.
    for(var i in headers) {
    message += headers[i] + ‘: ‘+ e.namedValues[headers[i]].toString() + “\n\n”;

    // Method B – Include specific columns in email
    // Include specific columns in email
    //message += headers[1] + ‘: ‘+ e.namedValues[headers[1]].toString() + “\n\n”;
    //message += ‘Submitted on: ‘ + e.namedValues[headers[0]].toString() + “\n\n”;

    // Insert variables from the spreadsheet into the subject.
    subject += e.namedValues[headers[2]].toString();

    // Get current user from the spreadsheet
    email = e.namedValues[headers[2]].toString();

    // Send the email
    MailApp.sendEmail(email, subject, message);

  13. It should now look like this:
    Entered Code
  14. Modify the green highlighted segments to suit your needs (e.g. the email subject line). To ensure that you are referring to the correct column, follow to step #9 to understand what to change x to in headers[x]
  15. Save the project, then click on Resource, and Current project’s triggers: Set up a Trigger
  16. Enter a project name:
    Project Name
  17. Then set up a trigger as follows:
  18. It will then ask you to authorize the script, so that it can send email messages: Authorize the Script
  19. When people fill out your form, you/they will get email notifications!
    Example Email