1
votes

What actually triggers the google appscript onFormSubmit event when form reponses are sent to a google sheet?

Asking because when looking at the google API example for handling form responses, they use a linked sheet and monitor submit event from there

ScriptApp.newTrigger('onFormSubmit').forSpreadsheet(ss).onFormSubmit().create();

The onFormSubmit submit is linked to the sheet, but the object is a sheet, so does entering any data into the sheet itself count or is it only from the Form that is linked to the Sheet? If I wanted to reference the form by ID, would I use the Form ID or the linked Sheet ID? Would the event data still be the same?

Any docs as to what is going on under the surface that could help clarify how this works?

1
There is an onsubmit trigger for the form and for the spreadsheet. The onFormSubmit trigger is tied to a function in either or both the form and the spreadsheet. The trigger is created when a form makes a submission. Each trigger has a different event block that is the one for the form is different than the one for the spreadsheet.Cooper

1 Answers

3
votes

There is an onformsubmit trigger for the form and another one for the spreadsheet. The onFormSubmit trigger for the form is tied to a function in the Forms script editor and it's triggered on a form submission.

onFormSubmit Trigger for form

The onFormSubmit Trigger for the spreadsheet is tied to a function in the script editor of the spreadsheet where the linked sheet is contained and it also triggers on a form submission. The trigger for the spreadsheet occurs after the linked sheet receives it's data.

onFormSubmit Trigger for Spreadsheet