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

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

问题描述

我正在尝试根据当前选定的单元格更新 Google 表格中侧边栏的内容.我的第一个虚拟脚本是:

function onSelectionChange(e) {var ui = SpreadsheetApp.getUi();var 范围 = e.range;var selectedRow = range.getNumRows();var htmlOutput = HtmlService.createHtmlOutput('这是行'+selectedRow).setTitle('标题');ui.showSidebar(htmlOutput);}

...它什么都不做,即永远不会显示侧边栏.我尝试停用应用脚本 v8,没有变化.

解决方案

在当前阶段,OnSelectionChange事件触发器作为简单触发器.在这种情况下,不幸的是,侧边栏不能与此事件触发器一起使用,因为它需要授权.Exception 的错误:您没有权限调用 Ui.showSidebar.所需权限:https://www.googleapis.com/auth/script.container.ui 出现.不幸的是,这是当前的答案.

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

为此,如何为问题跟踪器提出这个作为未来的请求?>

参考:

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);
}

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

解决方案

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.

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?

Reference:

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

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