Google Sheet加载项onInstall()和onOpen()不起作用 [英] Google Sheet add-on onInstall() and onOpen() not working

查看:193
本文介绍了Google Sheet加载项onInstall()和onOpen()不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图为Google表格创建一个附加组件,但运行问题。



附件在附件中创建附加菜单,菜单使用Google Drive API的 onOpen()函数,但它不会执行 onInstall()。所以我被告知添加以下内容:




$ b

function onInstall (e){
onOpen(e)
}

现在,我试图做的是以下,但它仍然无效

函数onInstall(){
SpreadsheetApp.getUi()。createAddonMenu()
.addItem('Browse My Add-on','browseMyAddOn')
.addToUi();
}

函数onOpen(){
SpreadsheetApp.getUi()。createAddonMenu()
.addItem('Browse My Add-on','browseMyAddOn')
.addToUi();
}

请帮助我

 函数onInstall(e)解决方案

{
onOpen(e);
}

$ b $ function $ on $ {
$ Spb $ b $ { )
.addToUi();
}


I am trying to create an add-on for Google Sheets, but running in the problem.

The add-on creates additional menu in "Add-on" menu using onOpen() function of Google Drive API, but it does not do that onInstall(). So I have been told to add the folloing

function onInstall(e) {
   onOpen(e)
}

now, what I have tried to do is the following, but it still does not work

    function onInstall() {
       SpreadsheetApp.getUi().createAddonMenu()
          .addItem('Browse My Add-on', 'browseMyAddOn')
          .addToUi();
    }

    function onOpen() {
        SpreadsheetApp.getUi().createAddonMenu()
          .addItem('Browse My Add-on', 'browseMyAddOn')
          .addToUi();
    }

Please help me

解决方案

I think you should try this one instead:

function onInstall(e) {
   onOpen(e);
}

function onOpen(e) {
    SpreadsheetApp.getUi().createAddonMenu()
      .addItem('Browse My Add-on', 'browseMyAddOn')
      .addToUi();
}

这篇关于Google Sheet加载项onInstall()和onOpen()不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆