Is it possible to add a second level sub-menu (sub-sub-menu) to a Google spreadsheet? I know how to add a menu with a sub-menu but what I need is to add one level more. Thanks.
You can add a sub-sub-menu now. I believe you should be able to continue to nest multiple menus.
DocumentApp.getUi()
.createMenu("TopMenu")
.addItem('Top Item', 'topProgram')
.addSeparator()
.addSubMenu(DocumentApp.getUi().createMenu('SubMenu')
.addItem('Sub Item', 'subProgram')
.addSubMenu(DocumentApp.getUi().createMenu('Sub Sub Menu')
.addItem('SubSub Item', 'subSubProgram')))
.addToUi();
The idea above would that you create a menu and just added it as a "sub menu". The example below creates the same menu above, but more clearly broken out.
var subSubMenu = DocumentApp.getUi().createMenu('Sub Sub Menu')
.addItem('SubSub Item', 'subSubProgram');
var subMenu = DocumentApp.getUi().createMenu('Sub Menu')
.addItem('Sub Item', 'subProgram')
.addSubMenu(subSubMenu);
var topMenu = DocumentApp.getUi().createMenu('Top Menu')
.addItem('Top Item', 'topProgram')
.addSubMenu(subMenu);
topMenu.addToUi();
Looks like this is not possible. You can take a look at Issue 317, but it doesn't look like it has made any progress in the past 2 years, so don't get too excited. Anyways, you can follow it and see if there are any updates.
Second tier drop down menus are, IMO, not a great design pattern. You will get better use and it's possible to instead have each parent category as a separate menu with simple lists in each (unless of course you are looking for a gazillion commands).
I'm not looking to diminish your need, but not having it is a win for user experience.
© 2022 - 2024 — McMap. All rights reserved.