英文:
Drop Down Menu won't show up, how do I fix it?
问题
这是我的代码如下,下拉菜单不会显示!我在这里的另一篇帖子中看到可能是因为脚本没有附加到任何工作表,所以我添加了getdocument但仍然不起作用。
我已经在电子表格的事件上设置了一个触发器,用于打开此onpen函数。
有人可以帮助我吗?
谢谢
function onOpen(){
doc = DocumentApp.getActiveDocument();
var menudrop = SpreadsheetApp.getUi();
menudrop.createMenu('刷新报告');
menudrop.createMenu.addItem('刷新CO', 'copyClearPasteAUDashboard','combinedLive');
menudrop.createAddonMenu.addItem('刷新SW', 'copyClearPasteSWDashboard','combinedLive');
menudrop.addToUi();
}
英文:
This is my code below, the drop down menu wont' show up! I saw in another post here that could be because the script wasn't attached to any sheet so I went ahead and added the getdocument but still not working.
I have set a trigger on event from spreadsheet On open for this onpen function.
Can somebody please help me?
Thanks
function onOpen(){
doc = DocumentApp.getActiveDocument();
var menudrop = SpreadsheetApp.getUi();
menudrop.createMenu('Refresh Reports');
menudrop.createMenu.addItem('Refresh CO', 'copyClearPasteAUDashboard','combinedLive');
menudrop.createAddonMenu.addItem('Refresh SW', 'copyClearPasteSWDashboard','combinedLive')
menudrop.addToUi();
}
</details>
# 答案1
**得分**: 0
"var menudrop = SpreadsheetApp.getUi();" 应更改为 "var menudrop = DocumentApp.getUi();"
<details>
<summary>英文:</summary>
This `var menudrop = SpreadsheetApp.getUi();` should be this ` var menudrop = DocumentApp.getUi();`
</details>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论