Tom Sawkins
Tom Sawkins

Reputation: 361

Custom Menus Google Apps Script

I have 3 custom menus that trigger when we open the spreadsheet

Problem is the order keeps changing each time I open the Spreadsheet

I would like it to appear in the exact same order each time - like File, edit, view etc

function MailMergeMENU() {
var ui = SpreadsheetApp.getUi();
ui.createMenu("MAIL MERGE")
.addItem("1.Star Track Import(MailMerge)","PrepareMailMerge")
.addSeparator()
.addItem("2.Send D2D SENT/Save File","D2DSENT")
.addToUi();

}

Upvotes: 0

Views: 1333

Answers (1)

krismans
krismans

Reputation: 88

Maybe you should try in this way:

function onOpen(){
var ss = SpreadsheetApp.getActiveSpreadsheet();
var menuList= [
    {name: "1.Star Track Import(MailMerge)", functionName: "PrepareMailMerge"}, 
    {name: "2.Send D2D SENT/Save File", functionName: "D2DSENT"}
];
var menuList2= [
    {name: "My menu name", functionName: "myFunction1"}, 
    {name: "2My menu name2", functionName: "myFunction2"}
];
  
ss.addMenu("MAIL MERGE", menuList);
ss.addMenu("CLEAR FORM", menuList2);
}

I have used this and my menu stays the same all the time.

Upvotes: 3

Related Questions