有没有办法告诉函数哪个菜单项被调用?

时间:2018-09-14 09:16:24

标签: google-apps-script menu

我知道在Google脚本中使用菜单项调用函数时无法传递变量。被调用函数是否至少可能知道被调用的菜单项的名称,或者至少是数字标识符?说我有以下几点。

SpreadsheetApp.getUi().createMenu('Angebotserstellung')
      .addItem('customerA','functionCustomer')
      .addItem('CustomerB', 'functionCustomer')  
      .additem('CustomerC','functionCustomer')
      .addToUi

是否有一种方法可以让被调用函数知道绑定到的菜单项(例如CustomerA),或者至少知道菜单项的数字顺序,例如项1或0?

0 个答案:

没有答案
相关问题