Limit Responses in Google Forms Using Google Apps Script

  • We are having a Cloud computing workshop.
  • But the hall that we have booked has a max capacity of 100 people.
  • People can register for the workshop through a Google Form.
  • The organizing Team wants to make sure that there are only 100 responses in the Google Form.

Step1: Sample Google Form

  • Name of the Attendee
  • Email Address of the Attendee
  • Phone number of the Attendee
This is the Google Form that the Attendee will fill

Step2: Write the Automation Script

function Limit_Responses() {
max_responses = 5;
var form = FormApp.openById("17XDAjSnwB8gU0CIpiDLRv3Q7-Ozfro- n0pRDQOAEjuI");
var responses = form.getResponses();
len = responses.length;//Logger.log(len);if (len == max_responses){
form.setAcceptingResponses(false);
}
}

Step3: Add a Trigger

Here you can add your custom messages

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Aryan Irani

Aryan Irani

Currently pursuing B Tech at MPSTME. Technical Blogger, interested in Google Workspace. Hope to remain a life long student.