-2

I have script that uses whole limit time for scripts(6 minutes). So I decided just to make my job in parts. So I have script "Generate words". I need to run this scripts,and after "generate words" I need to do it again. Also I need to run it with arguments, so for example: "generate words(0,2)".

I cant just call this function again because of this time limit from AppsScripts.

So,I need to run script with arguments, from script, but to run it in other session, so time limit wont be exceeded.

Kirill Az
  • 19
  • 4

1 Answers1

0

To pass arguments to a function, you need to use a function that pase those arguments, i.e., let say that you want to execute a function called something but it requires two parameters, a, and b, first create a function (in the below example it's named main, that will pass such paramenters, the call this new function from the Editor toolbar :

function main(){
  const a = 'A';
  const b = 'B';
  something(a,b)
}

function something(a,b){
   console.log(`${a} - ${b}`)
}

If the arguments to be passed are calculated by other functions, you might save them using the Properties Service or another stuff like a spreadsheet.

Related

Rubén
  • 34,714
  • 9
  • 70
  • 166
  • My arguments will change in process,and i need to trigger somehow function,not just call it in this session – Kirill Az Feb 08 '22 at 07:37
  • Please checkout the answers to the associated question. If you need further help, please post a new question showing what you tried and a brief description of your search efforts as is suggested in [ask]. – Rubén Feb 08 '22 at 16:18