Hi,
I have actually orginally posted the below text here:
https://support.google.com/docs/thread/225184819/script-is-triggered-several-times-when-it-shouldn-t...
But I was wondering if someone from here know if there is another way of triggering scripts in google sheet coming from Appsheet other than 'OnChange'?
If you read below text, I dont know if my problem could be solved with better code, but as I dont know much about scripting ( and used ChatGPT a lot) I think my problem could be solved if I could just use the evet type 'On formsubmit'?
Hi all,
For the last 3 months this has been running okay, but today a problem started.
Story short:
I am running an Appsheet app on a tablet in a public place where truck drivers can enter information and get a parking permit printed.
Their answers from the app goes into a Google spreadsheet.
In google sheet I have 4 different scripts running to handle the answers.
Normally if I had to do some changes in the sheet, I deleted my 'Trigger' to be able to do adjustments without triggering the script.
Before the appsheet app, I was using Google Form, and the trigger event type was set to 'On form submit', it worked brilliant.
For reasons, I changed to use Appsheet, which means my trigger event is now set to 'On change', so each time a truck driver is filling out the info on the tablet, his answer goes to the google sheet, and script is triggered because of a 'change'.
In the beginning I couldn't understand that each time I would do a small adjustment fx making a cell a bit bigger or smaller, or maybe put a title in the top of the sheet, you know just any adjustments in the sheet, then the script was triggered and processed the last row again, giving me a duplicate row.
Yay I figured out, oooh yeah it's because the trigger is 'on change'. Damn I hate that appsheet cannot use the event 'On form submit'.
But yes, since I now know that I just have to delete my trigger, do the adjustments and then enable (or create) the trigger again, then it runs.
But here is the problem.
From today, it starts duplicating all the anwers, the same way as if I was doing some adjustments and therefor triggered the script again, but no-one is touching the sheet. It is locked and people only have read-permissions.
If I go to the executions log, each time a new entry comes in it is handled correctly, but one second later, it is triggered again with this error:
User | Count |
---|---|
18 | |
9 | |
8 | |
5 | |
5 |