无法在 Google 表格脚本的测试部署中测试 onInstall。

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

Cannot test onInstall on test deployment in google sheet scripts

问题

My onOpen函数用于在Google表格脚本中显示自定义菜单,它运行得很好,而且我还简单地创建了onInstall函数如下:

function onInstall(e){
   onOpen(e)
}

onOpen在所有授权类型下都运行正常,但当我尝试发布插件时,Google会给出以下错误:

菜单 - 安装应用后未显示菜单选项。请确保插件正确使用onInstall()onOpen()来填充其菜单。菜单项在首次安装插件和打开不同文件时填充。请参阅编辑器插件授权。

因此,我不明白这个问题,如果有人知道如何模拟onInstall,请告诉我。

我尝试运行测试部署,但无法模拟onInstall

英文:

My onOpen for showing custom menu in google sheet scripts is working perfectly and I have also done onInstall simply like this

function onInstall(e){
   onOpen(e)
}

onOpen is running under all oath types but then google give this error when I try to publish addon

> Menu - Menu options not shown after App is installed. Please ensure that the add-on correctly uses onInstall() and onOpen() to populate its menu. The menu items populate when the add-on is first installed and when a different file is opened. See Editor add-on authorization.

So I don't understand this problem also if anyone know how to mock onInstall please let me know.

I tried running test deployment but cannot mock onInstall in it.

答案1

得分: 0

找到解决方案,正如Daniel所提到的。

首先私下部署和测试扩展,然后当扩展公开部署时,它应该正常工作。否则,我们无法测试 onInstall。

英文:

Found the solution as Daniel mentioned.

First private deploy and test the extention then it should work when extention will be deployed publically. Otherwise we can't test onInstall.

huangapple
  • 本文由 发表于 2023年3月8日 15:42:02
  • 转载请务必保留本文链接:https://go.coder-hub.com/75670414.html
匿名

发表评论

匿名网友

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

确定