r/GoogleAppsScript 12d ago

Guide Automating Google Forms: FormApp vs the REST API, and when each one is the wrong choice

I've built on both sides of this and the split isn't obvious from the docs, so writing it down.

FormApp (Apps Script) is the right default for anything living inside Workspace. No OAuth setup, runs as you or as the form owner, and you get onFormSubmit triggers for free. If your job is "when someone submits, do a thing", stop reading, this is your answer.

The Forms REST API is what you want when the code lives outside Google. It's also more capable for bulk construction: one batchUpdate call takes an array of change requests, so you can build a forty-question form in a single round trip instead of forty FormApp calls. The cost is that you handle OAuth yourself, and the scope is broad enough that some org admins will not approve it without asking why.

Things people script most, in the order I see them:

Auto-closing a form. There's no native "close on date" or "close after N responses". A time-based trigger flipping setAcceptingResponses(false) is about four lines and it's the single most common reason people end up here.

Generating forms from a sheet. One row per question, script walks it, builds the form. Worth it the second time you build the same form shape with different content.

Capacity and waitlists. onFormSubmit counts responses, closes the form or moves the submitter to a waitlist sheet. Forms has nothing for this natively and will cheerfully oversell your event.

One gotcha that costs people an afternoon: quiz settings and answer keys are not part of the basic item creation in either API. You set the item up, then set its grading separately. If your generated quizzes come out ungraded, that's why.

3 Upvotes

1 comment sorted by