When a Google Form saves its answers to a sheet, each response adds a row to Form Responses 1. To act on a response as it arrives (route it, send a reply, add an ID), install a trigger that runs your function on form submit:
ScriptApp.newTrigger("onIntake") followed by .forSpreadsheet(SpreadsheetApp.getActive()), .onFormSubmit() and .create()
Run that setup function once; the trigger stays with the project and shows on the Triggers list. newTrigger takes the handler's name as text. Each response then calls onIntake(e) with:
- e.values: the answers as text, in column order, starting with the Timestamp at e.values[0].
- e.namedValues: answers by question, each one an array, so the team is e.namedValues["Team"][0].
- e.range: the new row on the responses sheet.
An unanswered optional question arrives as an empty string. Running setup twice installs two triggers, and then every response is handled twice, so check ScriptApp.getProjectTriggers() first. Running onIntake from the editor has no event, so e is undefined there. In this practice copy, the checker submits test responses through your trigger.
The handler reads the response from the event and writes it where it belongs.