I have created a script on google sheets App script that will take a form submission, and put it into a new sheet. The way it does this is by calling on the last row with data, but when two forms are submitted at the same time, only one is submitted as the first did not have enough time to go through. Is there a way to still keep google forms open and delay the responses from updating the spreadsheet by 5 or so second intervals? I don't want data to be missed if two forms submit at the same time. Any help is appreciated as I am a COMPLETE beginner.
Asked
Active
Viewed 156 times
0
-
Please provide enough code so others can better understand or reproduce the problem. – Community Sep 25 '22 at 14:14
1 Answers
0
Casey, I think what you need is LockService. You can set the lock prior to any edits and release it once you've updated the sheet. If any concurrent updates need to happen, they will wait until the lock is released. Full example here.

user2069561
- 116
- 1
- 5
-
@PeterSmith is there a way to lock the sheet between form submissions. For example, if a form was submitted at the same time as another, but a second sooner, lock the ss for say 5 seconds, and then allow the second form to update the submission? I need at least 3 seconds in between form submissions, and have no idea how to implement that. Unless I read that incorrectly, that locks the sheet and doesn’t allow for the second form submission to update the ss. – Casey J Sep 29 '22 at 19:11
-
Hi Casey, it locks the sheet until the first submission is completed, releasing it afterwards and making it available to the second submission, which was waiting for the first to complete. I hope that makes sense! – user2069561 Sep 30 '22 at 04:58