如何在其他工作表的应用脚本中请求或获得Google电子表格访问权限? [英] How to request or get the permission of google spread sheet access in the apps script of other sheet?

查看:72
本文介绍了如何在其他工作表的应用脚本中请求或获得Google电子表格访问权限?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为自定义功能编写A电子表格的应用程序脚本,并尝试使用openUrl()

I am writing apps script of A spread sheet for my custom functions and trying to get values in B spread sheet from there using openUrl()

但是,当我使用自定义功能时,我在电子表格中得到了ERROR.

However, I got ERROR in A spreadsheet when I use the custom function..

在Google文档中显示

in Google Document, it says

如果您的自定义函数抛出错误消息您没有调用X服务的权限.",则该服务需要用户授权,因此无法在自定义函数中使用.

If your custom function throws the error message You do not have permission to call X service., the service requires user authorization and thus cannot be used in a custom function.

ref: https://developers.google.com/apps-script /guides/sheets/functions

但是,它没有说明如何获得许可..

However, it doesn't say anything how to get the permission..

  1. 我尝试了与所有人的共享链接,但没有用.
  2. 我尝试过url&scope=https://www.googleapis.com/auth/spreadsheets

两种方法均无效.我该如何解决这个问题?

Both way didn't work. How can I solve this problem?

推荐答案

不幸的是,您要求的内容无法直接完成.在同一文档中,请一直向下滚动到共享;那是-

Unfortunately, what you're asking for cannot be done directly. In the same documentation, please scroll all the way down to sharing; that's -

Google表格中的自定义功能>高级> 共享

Custom Functions in Google Sheets > Advanced > Sharing.

在这里,您将看到以下内容-

Here, you'll see the following -

自定义功能开始绑定到创建它们的电子表格.这意味着在一个电子表格中编写的自定义功能不能在其他电子表格中使用,除非...

Custom functions start out bound to the spreadsheet they were created in. This means that a custom function written in one spreadsheet can't be used in other spreadsheets unless...

如果适合您,您可以使用他们在此处列出的3种方法来解决此问题.

If it suits you, you can make use of the 3 methods that they've listed there to overcome this problem.

希望这会有所帮助!

这篇关于如何在其他工作表的应用脚本中请求或获得Google电子表格访问权限?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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