Google-sheets – Google form adding more than one row every time

google sheetsgoogle-apps-scriptgoogle-apps-script-triggersgoogle-forms

I know that when a new response is submitted on Google form, a new row is auto-added to the linked spreadsheet. I use several onformsubmit triggers for my form and linked spreadsheet. But I do not know why more than one row (sometimes more than 100) are being added, which is unnecessary. I have searched Google and Youtube but I think I could not find anything helpful. why is that happening? and how to avoid it?

Best Answer

It's very likely that having several form summit triggers be part of the problem. Another thing that could be causing the problem is having form submissions while a form submit triggered script is running. One more thing that could be causing the problem is a know bug that that a single form submission trigger is triggered multiple times by a single form submission.

The workaround for the the last one is to check if the event object includes the responses or not, if the responses are included, continue otherwise terminate immediately.