Monday, 15 May 2017

How to Schedule Your Google Forms and Limit Submissions

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

Related Posts Plugin for WordPress, Blogger...

Labels

404 AdBlock Add-on Airtel GPRS Trick Airtel SMS Trick Alexa Amazon Amazon Kindle Amazon Prime Android Android 8 Android Oreo antivirus Apple Apple Mac ASCII Audacity Audio Authotkey Backup Balance Transfer in Vodafone Battery Bing Blogger Blogging Bookmarklet Browser Camera Chromebook clock Cloud colors command lines Computer Computer Tricks configuration Contact Creative Commons Credit Card CSS devolop DIY Doodle DOS Download Dropbox E-Mail eBook Email Email Attachment Embed Encryption English Error Evernote Eyes Facebook Facebook Tricks Feedburner Flipkart Font Foursquare Free Internet Free sms trick in Vodafone G Mail Gadget Game Getty Images GIF Gists Github Google Google AdSense Google Analytics Google Apps Google Chrome Google Contacts Google Currents Google DNS Google Docs Google Drive Google Earth Google Font Google Forms Google Images Google Map Google Photos Google Play Store Google Plus Google Print Google Reader Google Script Google Sheets Google Spreadsheet Google Translate GPRS Setting GPS Hacking Health App HelloFax Hindi Hoodie HTML Icons idea Image Editing Images IMEI Indian Railways Infographics Instagram Internet Internet Explorer Internet Tricks iOS iPad iPhone IRCTC iTunes iTV JavaScript JioCinema JioTV Junglee Kindle Language Translation Laptop Laptop. TV Life Time FREE GPRS Life-Style Link Linkedln Linux logo Make Money Online Microdoft Powerpoint Microdoft Word Microsoft Office Microsoft Outlook Mobile Mosaic Music Name Networking nexus Notepad OCR Online Shopping Open DNS OS Outlook Password PDF Petya Phillips Hue Lights Photogtraphy Pixel Play Station Podcasts Pokemon Pokemon Go Polls Print Productivity Proxy Server Pushbullet QR Code Ransomware Reddit Reliance Hack GPRS Reliance Jio RGB Ringtone Router RSS Safe Mode Samsung Galaxy S Scrabble Screen Capture Screen Sharing Screencast Secrets Security Send free sms from PC SEO Sierra Skype Slideshare SMBv1 SMS Snapchat Snapdeal Social Media Solution Sound Device Speech Recognition Sql Steam Sync Synology NAS Tata Docomo GPRS trick Teleprompter Torrent Trick Tricks TV Twitter UltraISO Unicode Unknown Extension Unlimited 2GB Unlimited 3GB Unlimited GPRS USB USB Security Key Video Editing virtual desktop Virus attack VLC Vodafone 110% working trick for GPRS Vodafone 3g Vodafone GPRS VPN wallpapers WannaCry Web Design Web Domain Website Wget Whatsapp WiFi Wikipedia Windows Windows 10 Windows 10 S Windows KN Windows Tricks windows updates Winows N Wolfarm Alpha WordPress XBox YouTube Zip
Twitter Delicious Facebook Digg Stumbleupon Favorites More