Control responses in Google Forms!

Aya Sayed
2 min readJul 26, 2020

--

If you are using Google Forms to handle sign-ups for an upcoming event, and you want to control the number of responses (Limit responses), Guess what! you can do it using Google apps script (only in 4 Lines of Code)

The solution consists of creating a function that is executed each time a reply is sent. The function will check the number of responses and if it exceeds the limit you set, it will turn off the form (no further responses will be accepted).

How we can do that?

  1. Create a new Google Form & open Script Editor

2. Replace the existing Code with this

function Limit() {
var f
= FormApp.getActiveForm(); //will work with the active form
var r = f.getResponses(); // get all responses
// check the number of responses if > 100 close the form
if(r.length > 100) {
f.setAcceptingResponses(false);
}
}

3. save your code and set the project name

4. run your project

Here we go! The responses to your form are now limited. you can submit your form and you will notice that after 100 submits, the form is disabled and you can not submit another answer.

--

--