如何整合此代码,以便所有功能都列在同一标题(下拉列表)下?感谢。
function onOpen ()
{ var sheet = SpreadsheetApp.getActiveSpreadsheet ();
var menu = [ {name: "extract e-mail",functionName: "GetAddresses"} ];
sheet.addMenu ("Extract E-mail", menu);
var menu = [ {name: "remove self",functionName: "readRows"} ];
sheet.addMenu ("AOA", menu);
var menu = [ {name: "remove duplicates",functionName: "removeDuplicates"} ];
sheet.addMenu ("Duplicates", menu);
var menu = [ {name: "send e-mail",functionName: "sendEmails"} ];
sheet.addMenu ("Mail Merge", menu);
}
答案 0 :(得分:2)
您可以将菜单项作为对象数组传递。
function onOpen ()
{
var sheet = SpreadsheetApp.getActiveSpreadsheet ();
var menu = [
{name: "extract e-mail",functionName: "GetAddresses"},
{name: "remove self",functionName: "readRows"},
{name: "remove duplicates",functionName: "removeDuplicates"},
{name: "send e-mail",functionName: "sendEmails"}
];
sheet.addMenu ("Mail Merge", menu);
}