Sending emails twice with MailApp.sendEmail

前端 未结 1 1374
一个人的身影
一个人的身影 2021-01-22 12:49

I have created a google apps script to automate emails once a Google Form is submitted. The script is quite simple:

function AutoConfirmation(e){
  var theName =         


        
相关标签:
1条回答
  • 2021-01-22 13:19

    It appears the issue is being caused by the internal process that syncs form responses to the spreadsheet. Under some circumstances it makes slight updates to the "Timestamp" column of previously submitted form responses, which cause the onFormSubmit triggers to fire again for those rows (albeit with incomplete event objects).

    The engineering team is still working on a fix, but in the mean time you can work around this issue by filtering out form submit events that only affect the timestamp column. Since you can reorder the columns in a Form Responses sheet, the best way would be to check if the event's range only covers a single column:

    function onFormSubmit() { if (e.range.columnStart == e.range.columnEnd) return;

    // The rest of your code // ... }

    0 讨论(0)
提交回复
热议问题