Auto-close a form at a capacity limit
Stop accepting Northwind RSVPs once a quota is hit — no overselling the workshop.
Published Jul 29, 2025
Northwind runs hands-on workshops with a hard cap — the room only seats fifty. A Google Form collects the RSVPs, but a form happily accepts response number fifty-one, and number sixty. By the time anyone notices, ten people have been promised a seat that does not exist, and someone has to send the awkward emails.
This automation watches the response count and closes the form the moment it reaches the limit. It swaps in a friendly “we’re full” message so latecomers see a clear notice instead of an open form, and it only acts while the form is still accepting responses, so it is harmless to leave running.
What you’ll need
- A Google Form collecting the RSVPs, and its file ID.
- A capacity number — the seat limit for the event.
- Nothing else: the script reads the response count and closes the form itself.
The script
// The RSVP form to monitor.
const FORM_ID = '1abcFormId';
// Maximum responses to accept before closing the form.
const CAPACITY = 50;
// Message shown once the form is closed.
const CLOSED_MESSAGE = "We're full — thanks for your interest.";
/**
* Closes the RSVP form once its response count reaches CAPACITY, and
* replaces the closed-form message with a friendly notice.
*/
function checkCapacity() {
const form = FormApp.openById(FORM_ID);
// 1. Count the responses received so far.
const count = form.getResponses().length;
// 2. Close the form only if it is full AND still open — so a closed
// form is left untouched and the message is set just once.
if (count >= CAPACITY && form.isAcceptingResponses()) {
form.setAcceptingResponses(false);
form.setCustomClosedFormMessage(CLOSED_MESSAGE);
Logger.log('Capacity reached (' + count + ') — form closed.');
} else {
Logger.log('Responses: ' + count + ' of ' + CAPACITY + '.');
}
}
How it works
checkCapacityopens the form by ID and readsgetResponses().length— the total number of submissions so far.- It checks two things together: that the count has reached
CAPACITY, and that the form is still accepting responses. - The second check matters. It means the close logic runs exactly once — on the first run that finds the form full — rather than re-setting the message on every later run.
- If both are true, it calls
setAcceptingResponses(false)to close the form andsetCustomClosedFormMessageto show the “we’re full” notice. - Either way it logs the current count, so the execution history shows how the registration is filling up.
Example run
A scheduled run while registration is open:
| Responses | Form state | Action |
|---|---|---|
| 38 | Accepting | Logs “Responses: 38 of 50.” — no change |
| 50 | Accepting | Closes the form, sets the closed message |
| 50 | Closed | Logs “Responses: 50 of 50.” — no change |
Once the form is closed, anyone visiting the link sees “We’re full — thanks for your interest.” instead of the questions.
Trigger it
This needs to run on a schedule throughout the registration window:
- In the Apps Script editor, open Triggers (the clock icon).
- Click Add Trigger.
- Choose
checkCapacity, event source Time-driven, type Minutes timer, and pick Every 5 minutes. - Remove the trigger once the event is over so it stops running.
For an instant close instead of a five-minute window, attach an
On form submit trigger to the form so checkCapacity runs after every
single submission.
Watch out for
- A time-driven trigger leaves a gap. Between two five-minute runs the form can take a handful of extra responses — use an on-submit trigger if even one over the limit is unacceptable.
- The count includes every response ever submitted. If you reuse the form for a second event without clearing old responses, it will start already “full”.
- A closed form cannot be reopened by this script — it only ever closes. Reopen it by hand from the form’s settings if you raise the cap.
getResponses()loads every response object just to count them. For a form with thousands of entries that is wasteful but still fast enough for this use; it is worth knowing if you adapt the script.- Remember to delete the trigger after the event. A forgotten Minutes timer keeps running and quietly consumes your daily trigger quota.
Related
Trigger an onboarding sequence on form submit
Kick off tasks when a new Northwind hire submits their starter form.
Updated Oct 17, 2025
Build a content-submission queue
Collect Northwind guest posts or ideas for review through a Form.
Updated Oct 9, 2025
Score sentiment in open-text feedback
Rate Northwind feedback comments without manual review — using the in-Sheet sentiment function.
Updated Oct 5, 2025
Build a peer-nomination and voting system
Collect and tally Northwind nominations for awards or initiatives — one ballot, anonymous.
Updated Oct 1, 2025
Roll a form over each cycle
Archive old responses and reset for the next Northwind cycle — quarterly OKR check-ins.
Updated Sep 27, 2025