由于安装了应用程序后未显示的“菜单选项”,因此无法发布Google Editor Addon...。错误
我正在尝试将我的Google Sheet插件发布到Google Workspace。评论后,我收到了一封电子邮件,其中包含以下反馈:
菜单 - 安装应用程序后未显示的菜单选项。请确保该附加组件正确使用OnInstall()和onopen()填充其菜单。菜单项首次安装后以及打开其他文件时填充菜单项。请参阅编辑器附加授权。 , https://devevela -ons/Concepts/Editor-Auth-lifecycle
我添加了菜单,它在测试模式下工作,但我被困在此评论过程中。
的代码。
function onInstall(e) {
onOpen(e);
}
var userProperties = PropertiesService.getUserProperties();
function onOpen(e) {
// Adding menu to addons menu
if (e && e.authMode != ScriptApp.AuthMode.NONE)
{
SpreadsheetApp.getUi()
.createAddonMenu()
.addItem('Enable/Disable', 'showSidebar')
.addSeparator()
.addItem('History ', 'openHistoryDialog')
.addSeparator()
.addItem('Buy credits', 'addCredits')
.addSeparator()
.addItem('Settings', 'settingsDialog')
.addToUi();
// Default value for enable or disable.
userProperties.setProperty("enable_user", false);
}
}
这
{
"timeZone": "Asia/Karachi",
"dependencies": {
"enabledAdvancedServices": [
{
"userSymbol": "Sheets",
"serviceId": "sheets",
"version": "v4"
}
]
},
"exceptionLogging": "STACKDRIVER",
"oauthScopes": [
"https://www.googleapis.com/auth/spreadsheets",
"https://www.googleapis.com/auth/userinfo.email",
"https://www.googleapis.com/auth/userinfo.profile",
"https://www.googleapis.com/auth/script.external_request",
"https://www.googleapis.com/auth/script.container.ui",
"https://www.googleapis.com/auth/script.locale"
],
"runtimeVersion": "V8"
}
是一些代码
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该问题可能与添加的方式处理菜单有关,当前您的代码中的菜单是在条件语句上显示的,假设事件的状态与
script> scriptapp.authmode.none 但是,如果由于某种原因,此语句失败,则菜单将与菜单项一起显示,他们可能会在提到该行为时参考:
您可以检查在您试图检测授权模式时:
请注意,在分析处理当前授权模式的条件语句之前正在创建菜单。
The problem might be related with the way that the Add on is handling the menu, currently the menu in your code is displayed on a conditional statement assuming that the status of the event is different than
ScriptApp.AuthMode.NONE
however if for some reason this statement fails then the menu will fail to be displayed along with the menu items, they may be referring to that behavior when they mention:You could check the example given in the documentation as you are trying to detect the authorization mode:
Notice that the menu is being created before the conditional statement that handles the current authorization mode is analyzed.