Home > OS >  get buttons name or ID on Google sheets with AppsScript
get buttons name or ID on Google sheets with AppsScript

Time:12-02

In Google sheets application, after add a button and clicked on it to run a script, it is possible with a function, to return the ID or name of clicked button?

My goal is to use an unique function for some buttons and detect, which button is clicked. ( ID or name of clicked button ).

CodePudding user response:

You can't pass arguments with buttons. A workaround would be to create a different function for each button and then pass the button name to a main function.

function button1() {myFunction("Button1");}
function button2() {myFunction("Button2");}

function myFunction(args) {...}
  • Related