Questions on app script execution time out

117 views
Skip to first unread message

james cui

unread,
Aug 16, 2023, 6:57:09 PM8/16/23
to google-apps-sc...@googlegroups.com
Hey folks,

I was writing an add-on to iterate drive files, but that could hit the maximal timeout allowed by the script (~5 minutes). I did some research online. There were smart folks to store application status into properties service and continue with a time based trigger. I tried to reuse the same method, but it turns out "add-on can use a time-driven trigger once per hour at most" (https://developers.google.com/apps-script/guides/triggers/installable#time-driven_triggers) I tried two methods, 1. create a trigger in the addon with ScriptApp.newTrigger("myfunc").timeBased().everyMinutes(5).create(), but this failed at the creation statement. 2. create a trigger with ScriptApp.newTrigger("myfunc").timeBased().after(1sec).create(), then delete the trigger in myfunc, and register again. It does not work as well. 
My question is how do you continue the work to overcome the 5 mins limit? 


Thanks James

Andrew Roberts

unread,
Aug 18, 2023, 6:56:08 AM8/18/23
to google-apps-sc...@googlegroups.com
Interesting question! I can't think of an immediate answer, but could you do something with parallel processing using the HTML Service??

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/CA%2BMW333rz%3Din7DAbh6x5cGoj3ZP6JGP1EnsTdsN75HvNySnY1w%40mail.gmail.com.

james cui

unread,
Aug 18, 2023, 2:18:55 PM8/18/23
to google-apps-sc...@googlegroups.com
Thanks Andrew for the pointer, It was an interesting read. 
CardService was used in my addon, which might be hard to use this method?
Also, I saw many folks used triggers to overcome the time limit but all these 
failed in my experiments. Do you know whether the 1 hour limit is a new enforcement 
from google?  


Andrew Roberts

unread,
Aug 19, 2023, 8:14:37 AM8/19/23
to google-apps-sc...@googlegroups.com
The one hour limit has been around for a while.

derik carvalho

unread,
Sep 1, 2023, 9:32:32 AM9/1/23
to Google Apps Script Community
and how do you use this 1 hour run? here when I run a script the time expires in 6 minutes
Reply all
Reply to author
Forward
0 new messages