Google 应用界面实例中的自定义菜单。脚本只能与打开的文档或表单的当前实例的界面互动,并且只有在脚本绑定到文档或表单的容器时才能执行此操作。如需了解详情,请参阅菜单指南。
// Add a custom menu to the active spreadsheet, including a separator and a// sub-menu.functiononOpen(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();}
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2024-12-22。"],[[["The `Menu` class allows you to create custom menus in Google Apps Script, adding items, separators, and submenus."],["Menus can be used to provide users with easy access to script functionalities within the active document or form."],["Menu items are linked to specific functions within your script using the `addItem()` method."],["`addToUi()` inserts the created menu into the user interface of the current Google App instance."],["The provided code example demonstrates creating a basic custom menu with a submenu."]]],[]]