In an apps script project, i have to run a task that will take about 2 hours to complete,
so i decided to break it in parts and run each via timebased trigger.
In the below snippet:
the function longAction represent the function that needs to be run multiple times and this function will accept arguments a and b.
the lowerUpper() function returns a list of ranges[0-4, 5-9, 10-14, 15-19, 20-20], these represent row numbers in a googlesheet.
I tried creating copies of the longAction function using the bind method.
Which in turn i want to use in the ScriptApp timebased c while creating trigger.
Result: The triggers are created (ok).
Problem: I have the following error
Script function not found: function () { [native code] }
How can i correct the error? Or any other way of dealing with the problem.
I expected to create timebased triggers where each trigger runs the same function but with a different set of argument.
I have the following error:
Script function not found: function () { [native code] }
let longAction = function (a,b){
for(let i =a ; i<= b ; i++){
Logger.log(i) // for testing purpose
}
}
function test(){
let rng = lowerUpper(20,4) // [0-4, 5-9, 10-14, 15-19, 20-20]
for (j = 0; j < rng.length ; j++){
let low = rng[j].split('-')[0]
let upper = rng[j].split('-')[1]
// create copies of longAction function to use later in the trigger
let action1 = longAction.bind(null,low,upper)
ScriptApp.newTrigger(action1)
.timeBased()
.after(1 * 60 * 1000)
.create()
}
}