Thursday, June 27, 2013

Automatic Email Responses for Google Form Submissions

Since I use a Google form for student reassessment requests (very helpful, BTW), I've often had students forget what standard they registered for or which day or had "but I submitted it!" issues.

This script should solve that. In the form edit window, go to Tools and Script Editor, and add a script to your form.

Here's my script (modify to suit your needs):

function onFormSubmit(e) { 
 // these are the columns in the form:   
  var timestamp = e.values[0];
  var yourName = e.values[1];
  var Section = e.values[2];
  var std = e.values[3];
  var ReDate = e.values[4];

  var toAddress = e.values[5];

  var subject = "Reassessment Confirmation - " + std + " " + ReDate;

  var emailBody = "You requested a reassessment on: " + timestamp +      " for " + std +      ". \n\nThe reassessment will take place on " + ReDate +      ".";

  MailApp.sendEmail(toAddress, "you@yourschool.edu", subject, emailBody);
}

The last thing that you need to give the script permission to send emails. Go To Resources/All Your Triggers -> Run OnFormSubmit Events From Spreadsheet -> OnFormSubmit.

There are optional arguments for the sendEmail method that let you send fancy HTML emails, but this will work OK for me.
Enjoy!

3 comments:

  1. Dude! Genius! I'm going to try this out. I've seen the same thing with my students.

    ReplyDelete
    Replies
    1. Looks like I need to learn a bit of coding!

      Delete
    2. :) Glad that you like it - I've been aching for this one for a while!

      Delete