shenkwen
shenkwen

Reputation: 3880

Google App Script on form submit trigger: deployed in the spreadsheet vs deployed in the form

Intuitively, I set a on form submit function in the form's script editor and set the trigger accordingly.

function onSubmit(e) {
 console.log(e);
}

However, the output is like enter image description here

The response is empty.

I then move this function to the corresponding spreadsheet's code editor and set the trigger, and it works this time. The event object is just like what it says on https://developers.google.com/apps-script/guides/triggers/events?hl=en#form-submit

So why does this trigger has to be in the spreadsheet? And for the form, the function gets executed when someone submits their response, so the trigger was set right, why then the event object doesn't contain the response?

Upvotes: 1

Views: 1351

Answers (1)

doubleunary
doubleunary

Reputation: 18784

The e.response object is an instance of the FormResponse class. To inspect its contents, use the methods listed in the reference.

Upvotes: 2

Related Questions