0

I have a spreadsheet that needs to 'setValue' to about 2000 rows. The problem is, after awhile, I get time-out.

So I'm looking for a solution to split up the job.

I'm thinking of creating a time-based trigger, possibly to start off where the last row or timeout ended. But I can't figure how to get trigger unique ID.

function triggerList() {

  ScriptApp.newTrigger('populateList')
   .timeBased()
   .after(5 * 60 * 1000) // run every 5 mins. Script will time-out.
   .create();

}

function deleteTrigger() {
 // delete the above trigger
 var triggers = ScriptApp.getProjectTriggers();

 for (var i = 0; i < triggers.length; i++) {
   Logger.log(triggers[i]);
 }
}

There is a similar topic on this but i don't quite understand.
What happens when I "sleep" in GAS ? (execution time limit workaround)

Anyone has suggestions, workarounds?

Community
  • 1
  • 1
chopz
  • 381
  • 1
  • 5
  • 21
  • 1
    So you cant set the rows all at once? Why not? – Zig Mandel Apr 08 '15 at 15:23
  • 1
    Without info about how you're setting values (better yet, code), all we can do is guess about why it's slow. A sheet with 2000 rows isn't all that big - a properly optimized script should be able to handle that. Please update your question. – Mogsdad Apr 08 '15 at 17:03

1 Answers1

3

Put all of your data into a two dimensional array first, then set all the values at once. Each inner array is a row, each element of each inner array is a cell in a new column.

Set Values Documentation

Alan Wells
  • 30,746
  • 15
  • 104
  • 152