Google app script timeout ~ 5 minutes?

后端 未结 9 2146
粉色の甜心
粉色の甜心 2020-11-22 08:31

My google app script is iterating through the user\'s google drive files and copying and sometimes moving files to other folders. The script is always stopped after 5 minute

9条回答
  •  臣服心动
    2020-11-22 08:54

    Figure out a way to split up your work so it takes less than 6 minutes, as that's the limit for any script. On the first pass, you can iterate and store the list of files and folders in a spreadsheet and add a time-driven trigger for part 2.

    In part 2, delete each entry in the list as you process it. When there are no items in the list, delete the trigger.

    This is how I'm processing a sheet of about 1500 rows that gets spread to about a dozen different spreadsheets. Because of the number of calls to spreadsheets, it times out, but continues when the trigger runs again.

提交回复
热议问题