Google Forms impose no limits. Any poll or survey created inside Google Forms has no expiration date and it can collect unlimited number of responses until the form owner decides to manually close* the form.
For some Google Forms though, limits may be necessary. For instance, if you doing a contest or a giveaway on your website, you may only want to accept the first ‘n’ entries strictly on a first-come first-served basis. A teacher may want to open a form to students at a certain data and close it automatically at another date.
SET AN EXPIRATION CRITERIA FOR GOOGLE FORMS
Google Scripts can help you easily schedule your Google Forms and they’ll automatically open and/or close at a certain data. Similarly, the script can be configured to turn off your form after a certain number of entries have been received through the form.
1. Go to your Google Drive and open an existing Google Form or create a new form.
2. Inside the Forms Editor, click Tools -> Script Editor and copy-paste the code snippet available below.
3. While the Script Editor is open, go to File -> Project Settings and make sure that the correct time zone is selected.
4. Set the RESPONSE_COUNT equal to the total number of entries that you would like to receive after which the form is closed automatically. If you would not like to set a limit, set this value to blank.
5. Set the form’s open and close dates in lines #1 & #2 in YYYY-MM-DD HH:MM format. If you would rather not have an open or close date, just set the corresponding value to blank.
6. Press Ctrl+S (or Cmd+S on Mac) to save the script and choose Run -> Initialize to authorize the script.
The script will now run in the background and you’ll get an email notification when one of the conditions is met and the Google Form is closed for new responses.
GOOGLE SCRIPT FOR SCHEDULING GOOGLE FORMS
FORM_OPEN_DATE = "2014-12-20 08:00"; FORM_CLOSE_DATE = "2014-12-25 23:30"; RESPONSE_COUNT = "100"; /* Initialize the form, setup time based triggers */ function Initialize() { deleteTriggers_(); if ((FORM_OPEN_DATE !== "") && ((new Date()).getTime() < parseDate_(FORM_OPEN_DATE).getTime())) { closeForm(); ScriptApp.newTrigger("openForm") .timeBased() .at(parseDate_(FORM_OPEN_DATE)) .create(); } if (FORM_CLOSE_DATE !== "") { ScriptApp.newTrigger("closeForm") .timeBased() .at(parseDate_(FORM_CLOSE_DATE)) .create(); } if (RESPONSE_COUNT !== "") { ScriptApp.newTrigger("checkLimit") .forForm(FormApp.getActiveForm()) .onFormSubmit() .create(); } } /* Delete all existing Script Triggers */ function deleteTriggers_() { var triggers = ScriptApp.getProjectTriggers(); for (var i in triggers) { ScriptApp.deleteTrigger(triggers[i]); } } /* Send a mail to the form owner when the form status changes */ function informUser_(subject) { var formURL = FormApp.getActiveForm().getPublishedUrl(); MailApp.sendEmail(Session.getActiveUser().getEmail(), subject, formURL); } /* Allow Google Form to Accept Responses */ function openForm() { var form = FormApp.getActiveForm(); form.setAcceptingResponses(true); informUser_("Your Google Form is now accepting responses"); } /* Close the Google Form, Stop Accepting Reponses */ function closeForm() { var form = FormApp.getActiveForm(); form.setAcceptingResponses(false); deleteTriggers_(); informUser_("Your Google Form is no longer accepting responses"); } /* If Total # of Form Responses >= Limit, Close Form */ function checkLimit() { if (FormApp.getActiveForm().getResponses().length >= RESPONSE_COUNT ) { closeForm(); } } /* Parse the Date for creating Time-Based Triggers */ function parseDate_(d) { return new Date(d.substr(0,4), d.substr(5,2)-1, d.substr(8,2), d.substr(11,2), d.substr(14,2)); }
[*] If you would like to close your Google Form for new responses, open the Form inside your Google Drive and click the “Accepting Responses” option. You can re-open the form anytime later by checking the “Not Accepting Responses” button.
0 comments:
Post a Comment