I’m trying to set up a Google Sheets script that sends out a PDF of my spreadsheet automatically. The problem is that the time-based trigger isn’t precise enough for what I need.
Right now, I can only set it to run sometime within an hour-long window. But I need it to run at exactly 10:10 AM every other day (or daily if that’s the only option).
Is there a way to make the trigger more accurate? I really need it to fire at the exact time, not just sometime during that hour. Has anyone found a workaround for this limitation?
I’ve looked through the Google Apps Script documentation, but I couldn’t find anything about increasing the precision of time-driven triggers. Any tips or alternative approaches would be super helpful!
I’ve grappled with this issue too, and it can be frustrating when you need pinpoint accuracy. One approach that’s worked well for me is combining Google’s time-based triggers with a custom time-checking function. Here’s what I did:
I set up a trigger to run every minute (you could do every 5 minutes to save on quotas). In the script itself, I included a function that checks the current time. If it matches the exact time I want (in your case, 10:10 AM), it executes the main task.
It’s not 100% perfect, but it’s much more precise than the hour-long window. You might see a delay of a few seconds, but it’s generally reliable. Just keep an eye on your quota usage if you’re running it frequently.
Another option is to use Google Cloud Functions with a more precise cron job, but that’s a bit more complex to set up. Hope this helps!
hey, i’ve been there. Google’s triggers are sooo unreliable. have you tried an external service like zapier or ifttt to call your webhook exactly at 10:10? could be a neat workaround if you need precise timing. good luck!
I’ve encountered similar issues with Google Sheets script timing precision. Unfortunately, Google’s time-based triggers aren’t designed for exact minute-level accuracy. However, I found a workaround that might help you. Instead of relying solely on Google’s triggers, you could set up a time-checking function within your script. Set the trigger to run every minute (or every 5 minutes if you’re worried about quota limits). In the script, check the current time and only execute your PDF creation and sending if it matches your desired time. This approach isn’t perfect - there might still be a slight delay - but it’s generally more precise than the hour-long window. Just be mindful of your script’s execution quotas. If you need absolute precision, you might need to consider external scheduling services that can make API calls to trigger your script.