Skip to content

Instantly share code, notes, and snippets.

/Code.gs Secret

Created December 13, 2016 22:16
Show Gist options
  • Save anonymous/7c2e2ba5251b38f01fe5bca98a55ab6d to your computer and use it in GitHub Desktop.
Save anonymous/7c2e2ba5251b38f01fe5bca98a55ab6d to your computer and use it in GitHub Desktop.
bound Forms script to limit responses
// To create a bound script, open a Google Sheets, Docs, or Forms file, then select Tools > Script editor.
// Steps to make this function run on form submit:
// https://developers.google.com/apps-script/guides/triggers/installable#managing_triggers_manually
function lockOnFull(e) {
// Get the form to which this script is bound.
var form = FormApp.getActiveForm();
var formResponses = form.getResponses();
// room has 11 seats. Limit to 11 responses.
if ( formResponses.length > 10 ) {
form.setAcceptingResponses(false);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment