Google电子表格自定义菜单不会显示给匿名用户 [英] Google spreadsheet custom menus are not displayed for anonymous users

查看:373
本文介绍了Google电子表格自定义菜单不会显示给匿名用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到,Google电子表格*自定义菜单(请参阅下面的代码)不会显示给匿名用户,即直接从URL访问电子表格的用户(Link to share);您需要先签名。

*电子表格是共享的,权限是任何有链接的人都可以编辑。



这是预期的行为?

是否有任何解决方法可以使用户无需先登录自定义菜单?

代码(来自 Google )**:

  function myOnOpen(){
var ss = SpreadsheetApp.getActiveSpreadsheet();
var menuEntries = [{name:Say Hi,functionName:sayHi},
{name:Say Hello,functionName:sayHello}];
ss.addMenu(Tutorial,menuEntries);
}

函数sayHi(){
Browser.msgBox(Hi);
}

函数sayHello(){
Browser.msgBox(Hello);
}

** onOpen函数已被重命名为myOnOpen,并与可安装的触发器关联。我已经验证过它运行在电子表格所有者的上下文中。



TIA,



Olivier

p>

解决方案

从一个 answer 通过 + Samantha 添加到Google文档帮助论坛中的类似主题中


为了使脚本在Google表格上运行,用户必须记录
并拥有可编辑权限。这意味着匿名用户
不能运行脚本。

如果您希望将此功能添加到脚本中,那么I
建议导航至Google Developers的Apps Script支持
页面并按下发送反馈按钮。


注意:I只是在另一个答案中发布了相同的引用(类似问题)(显示观看者的边栏)。


I've noticed that Google spreadsheet* custom menus (see code below) are not displayed for anonymous users i.e. users who access the spreadsheet directly from the URL (Link to share); you need to sign first.
*The spreadsheet is shared and the the permissions are "Anyone with the link can edit".

Is this the expected behaviour?
Is there any workaround to make custom menus available to users without having to sign-in first?

Code (from Google)**:

function myOnOpen() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var menuEntries = [ {name: "Say Hi", functionName: "sayHi"},
                      {name: "Say Hello", functionName: "sayHello"} ];
  ss.addMenu("Tutorial", menuEntries);
}

function sayHi() {
  Browser.msgBox("Hi");
}

function sayHello() {
  Browser.msgBox("Hello");
}

**The onOpen function has been renamed myOnOpen and is associated to an installable trigger. I've verified that it runs in the context of the spreadsheet owner.

TIA,

Olivier

解决方案

From an answer by +Samantha to a similar thread in the Google Docs Help Forum

In order for Scripts to run on a Google Sheet, the user must be logged in and have "can edit" rights. This means that anonymous users will not be able to run a Script.

If you would like to see this functionality added to Scripts, I recommend navigating to the Google Developers' Apps Script support page and pressing the "Send Feedback" button.

Note: I just posted the same quote in another answer to a similar question (Showing sidebar for viewers).

这篇关于Google电子表格自定义菜单不会显示给匿名用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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