Home > google_form_notifier

google_form_notifier

Google_form_notifier is a project mainly written in JAVASCRIPT and RUBY, it's free.

Maintained in https://github.umn.edu/asrweb/google_form_notifier A Google Apps Script that sends an email to an arbitrary list of recipients any time a Google Form is submitted. The notification email contains a summary of the completed form and can

GoogleFormNotifier

GoogleFormNotifier is a simple Google Apps Script that can be installed on any Google Spreadsheets form to notify an arbitrary list of people upon form submission. The email that is generated is an HTML summary of the form data submitted.

Dependencies

This script depends on Handlebars.js and Underscore.js. The google_form_notifier-bundled.js file has these dependencies pre-packaged and minified. If you're going to be doing development on this script, you may need to make sure these are loaded and available.

Usage

Before you add this script, create a new sheet and name it 'Notification list' (case-sensitive). Add the email addresses you want to notify in the first column of this sheet.

1. Include the script

To use this script, place it on a web server that you control or trust (notice the eval) and include it into your Google Apps script like so:

eval(UrlFetchApp.fetch('http://example.com/google_form_notifier-0.9.0-bundled.js').getContentText());

2. Authorize the script

The first time you try to use this script, you'll have to fake-out Google by adding these lines and authorizing the functionality:

// Temporarily uncomment these lines to "authorize" the funcationality.
//
// SpreadsheetApp.getActiveSpreadsheet().getSheetByName("blah");
// MailApp.sendEmail("[email protected], "blah", "blah");
// Utilities.jsonStringify({"blah":"blahblah"});
// SpreadsheetApp.getActiveSpreadsheet().getOwner().getEmail();

Click the 'Run' button in the script editor and Google will pop up a message to authorize the actions. Click 'authorize' and then comment these lines back out or delete them.

3. Use the script

After these functions have been authorized, you can use the GoogleFormNotifier object. Just add a function to handle the onSubmit trigger:

function onSubmit(evt) {
  GoogleFormNotifier.notify(evt);
}

Development

If you're going to hack on this script, you'll want to circumvent Google Apps' caching by adding a random number to the url string:

eval(UrlFetchApp.fetch('http://example.com/google_form_notifier.js?' + Math.random().toString()).getContentText());

If you want to contribute, consider these possible TODOs:

  • Write about what Handlebars is and how to use custom templates.
  • Create some simple unit tests?
  • Find a graceful way to set the 'to' address or change the bcc notification scheme if not respondent username is collected.