0

that's my first time here so I am sorry if I will not follow StackOverflow guidelines to the line.

These days I had to create a pipeline for data collected by a Google Survey to a Google Sheet. The issue is that I am not able to debug in any way the function I wrote which should be triggered on-event formSubmit. The function is the following:

function notifyTeam(event) { // should triggered on formSubmit event

  var db = getDB() // custom function to connect to datasheet -> works fine
  var dt = new Date()
  var email = event.responses.getItemResponses()[0] // -> returns error due to event is undefined
  var sap_code = event.responses.getItemResponses()[0] // -> returns error due to event is undefined
  

I would like to know why on Earth the event parameter is undefined while I exactly followed Google Documentation.

Thanks so much for your help in advance.

4

1 回答 1

1

事件中的字段会有所不同,具体取决于“提交表单”触发器是否与表单或电子表格相关联。如果您的脚本绑定到电子表格,则需要使用event.namedValues而不是event.responses.

请参阅事件对象文档。

于 2021-04-21T09:17:30.737 回答