What is the difference between these two ways of getting the same thing (a new menu item)?
Version 1
function onOpen(e) {
SpreadsheetApp.getUi()
.createMenu('My Menu')
.addItem('My Menu Item', 'myFunction')
.addSeparator()
.addSubMenu(SpreadsheetApp.getUi().createMenu('My Submenu')
.addItem('One Submenu Item', 'mySecondFunction')
.addItem('Another Submenu Item', 'myThirdFunction'))
.addToUi();
}
Version 2
function onOpen() {
var menu = [{name: "My Menu Item", functionName: "myFunction"}]
SpreadsheetApp.getActiveSpreadsheet().addMenu("My Menu", menu);
}