onSelectionChange Google App脚本根本不起作用 [英] onSelectionChange Google App Script doesn't work at all

查看:86
本文介绍了onSelectionChange Google App脚本根本不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试更新Google表格中侧边栏的内容,具体取决于当前选择的单元格.我的第一个虚拟脚本是:

I'm trying to update the content of the sidebar in a Google Sheet, depending on the current selected cell. My first dummy script is:

function onSelectionChange(e) {
  var ui = SpreadsheetApp.getUi();
  var range = e.range;
  var selectedRow = range.getNumRows();

  var htmlOutput = HtmlService
  .createHtmlOutput('This is row '+selectedRow)
  .setTitle('Title');
  ui.showSidebar(htmlOutput);
}

...,它什么也没做,即没有任何侧边栏显示. 我试图停用应用脚本v8,没有任何变化.

... and it does nothing, i.e. no sidebar shows ever. I tried to deactivate app script v8, no change.

推荐答案

在当前阶段,将OnSelectionChange事件触发器用作简单触发器.不幸的是,在这种情况下,该边栏不能与该事件触发器一起使用,因为需要进行授权.出现错误Exception: You do not have permission to call Ui.showSidebar. Required permissions: https://www.googleapis.com/auth/script.container.ui.不幸的是,这是当前答案.

In the current stage, the OnSelectionChange event trigger is used as the simple trigger. In this case, unfortunately, the side bar cannot be used with this event trigger because it is required to authorize. An error of Exception: You do not have permission to call Ui.showSidebar. Required permissions: https://www.googleapis.com/auth/script.container.ui occurs. Unfortunately, this is the current answer.

但是,我认为在将来的更新中,当OnSelectionChange事件触发器可以用作可安装触发器时,您的目标就可以实现.

But, I think that by the future update, when the OnSelectionChange event trigger can be used as the installable trigger, your goal will be able to be achieved.

为此,为将来的请求问题跟踪器提出建议吗?

For this, how about proposing this for the issue tracker as the future request?

这篇关于onSelectionChange Google App脚本根本不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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