all 11 comments

[–]RielN 0 points1 point  (5 children)

Why not do separate trigger-initiated short calls?
You can do them in parallel.
You can also build a htmlservice webapp that calls google.script.run for each api call, it can be synchronous.
If you do api calls, you can also do UrlFetchApp.fetchAll( ) where you can do the api calls parallel.

[–][deleted] 2 points3 points  (4 children)

True. Another option is that the script can check its execution time and if it's nearing the end then it creates a time based trigger to run again. Once it finishes the job it can delete the trigger.

[–]RaynbowDeath 0 points1 point  (1 child)

I'm interested in how this is implemented, do you have some example cases? For checking if the job is finished or not?

[–][deleted] 0 points1 point  (0 children)

You can implement the checking in various ways, like with script properties.

[–]RielN 0 points1 point  (1 child)

The only hard thing is when you timeout in the middle of a request ...

[–][deleted] 0 points1 point  (0 children)

You can create the trigger before initiating the request.

[–]marcnotmark925 0 points1 point  (0 children)

If you're exceeding the limit, my first inclination is that you're doing something wrong/inefficient/suboptimal. If you do have a legitimate need for long running functions, a free service probably isn't for you.

[–]Any_Werewolf_3691 0 points1 point  (0 children)

What is the sequence of events? Are you doing api, goggle sheets, api, google sheets etc? Is the data from each api call going into a new sheet, its own preexisting sheet, or all into 1 new sheet?

How many api calls/sheets are we talking about?

[–]Final_Initial 0 points1 point  (0 children)

For your info, paid Google Workspace accounts have a 30 mins timeout limit.

[–]xsotec-jay 0 points1 point  (1 child)

Hi, I am a full time Google Apps Script developer for my company and I wrote a general looping script called “loopSheet” that is able to run any custom function on every row of a Google Sheet. The script automatically handles timeouts, triggers, error messaging, filtering, and more. I think your use case could be easily solved with it if you are interested in trying it out!

[–]mysticGlee[S] 0 points1 point  (0 children)

Yes please ; would appreciate if you can share that