下拉菜单不显示,如何修复?

huangapple go评论100阅读模式
英文:

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>



huangapple
  • 本文由 发表于 2023年5月21日 22:07:54
  • 转载请务必保留本文链接:https://go.coder-hub.com/76300302.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定