google-apps-scriptfunction-call

How do I create a macro that will run multiple already created macros


So if I have the following macros:

Pmoney Psteel Ptitanium Pplant Ppower Pheat

and I would like to create a new function/Macro that will run all of the above at once.

I understand there is a Call function on Excel but can't seem to make this work on Apps script

I tried:

function Callmacros(){
 
 Call Pmoney
 Call Psteel
 Call Ptitanium
 Call Pplant
 Call Ppower
 Call Pheat

}

It did not work as I don't think "Call" is a function in Apps Script


Solution

  • You may have some problems with this if you are changing the contents of a spreadsheet in one and then reading the values of the same spreadsheet in another. In reality I would avoid this and just put everything in one function because it will run faster and I can probably reduce the number of lines significantly through chaining or looping.

    function macros(){
      Pmoney();
      Psteel();
      Ptitanium();
      Pplant();
      Ppower();
      Pheat();
    }