I've been working on a script to alert me about low stock items in my inventory tracking spreadsheet, but the script works a little too well.
The issue is that each time I update the inventory for 10 items, the script runs and sends out 10 email notifications due to Google's "On Edit" trigger. To try and consolidate all these emails into one, I attempted to use Utilities.sleep(300000) to create a delay before the script runs again. However, this just resulted in the same 10 emails being delayed by 5 minutes.
It seems like Google processes the script in parallel with every trigger activated, causing multiple notifications to be sent out instead of just one consolidated email.
Any suggestions on how I can modify my script to only send a single email notification after all edits have been made?
This is my first coding project, so I'm still learning. Any guidance or help would be greatly appreciated!