Sun*_*nil 5 menu google-sheets google-apps-script google-apps-script-addon
我正在尝试制作这个附加插件,可以帮助我和其他人将工作表导出为 JSON。在我的测试中,菜单显示并且所有功能都有效(如屏幕截图中所示)。当我发送到 Google Web Store 上发布时,“Docs Add-ons Advisor”在评论中看不到菜单。因此,正如“Docs Add-ons Advisor”建议的那样,我将其发布为“不公开”,看看它是否适合我。但这不起作用。这是我正在使用的代码和链接。谁能告诉我我做错了什么并帮助我解决它。
参考:
代码:
function onInstall(e) {
onOpen(e);
}
function onOpen(e) {
var menu = SpreadsheetApp.getUi().createAddonMenu(); // Or DocumentApp or FormApp.
if (e && e.authMode == ScriptApp.AuthMode.NONE) {
// Add a normal menu item (works in all authorization modes).
menu.addItem('Export to JSON', 'exportInit');
} else {
// Add a menu item based on properties (doesn't work in AuthMode.NONE).
var properties = PropertiesService.getDocumentProperties();
var workflowStarted = properties.getProperty('workflowStarted');
if (workflowStarted) {
menu.addItem('Start to JSON', 'startJson');
} else {
menu.addItem('Export to JSON', 'exportInit');
}
}
menu.addToUi();
}
function startJson(){
...code...
}
function exportInit() {
..code..
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2018 次 |
| 最近记录: |