有什么方法可以从Google Sheet 2触发Google Sheet 1的功能吗? [英] Is there any way to trigger functions of Google Sheet 1 from Google Sheet 2?

查看:73
本文介绍了有什么方法可以从Google Sheet 2触发Google Sheet 1的功能吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以通过Google Sheet 2触发Google Sheet 1脚本编辑器的功能吗?

Is there any way I can trigger functions of Google Sheet 1 script editor from Google sheet 2?

我阅读了Google表格脚本的文档,并发现了有关库的信息,但在理解其工作方式时遇到了麻烦: 1)在项目键的项目属性中,它说已贬值"-这是否意味着我不能再共享库?

I read the documentation of google sheet scripts and found out about libraries but having trouble understanding how it works: 1) In properties of project by the project key, it says "Depreciated" - does that means i cannot share libraries anymore?

2)在Google工作表2中,当我尝试通过输入Google工作表1的项目密钥来添加库时,我不断收到以下错误消息:

2) In google sheet 2, when i am trying to add library by entering project key of Google sheet 1, i keep getting following error:

所选的库必须具有保存的版本才能包含在另一个脚本中.打开要添加为库的项目,保存版本,然后重试.

推荐答案

要将脚本#1的库成功添加到脚本#2,请按照下列步骤操作:

To successfully add a library of script #1 to script #2, follow these steps:

(1)在File > Manage Versions...Save New Version中创建脚本#1的库,如此处.

(1) Create a library of script #1 in File > Manage Versions... and Save New Version, as explained here.

(2)将脚本#1的Script ID复制到File > Project properties...(不是Project key ).

(2) Copy the Script ID of script #1 in File > Project properties... (not Project key).

(3)使用在步骤1中创建的库,在脚本#2中,转到Resources > Libraries...并添加在步骤2中检索到的Script ID,如

(3) Use library created in step 1: in script #2, go to Resources > Libraries... and add the Script ID you retrieved in step 2, as explained here.

将库添加到脚本#2后,可以通过在步骤3中写入添加到字段Identifier的单词来访问其功能.例如,如果库标识符设置为YourLibrary,并且其中之一库中的函数称为yourFunction,您可以通过编写YourLibrary.yourFunction()在第二个脚本中运行该函数.

Once you have added the library to script #2, you can access its functions by writing the word you added to field Identifier in step 3. For example, if the library identifier is set to YourLibrary and one of the functions in the library is called yourFunction, you can run that function in your second script by writing YourLibrary.yourFunction().

我希望这会有所帮助.

这篇关于有什么方法可以从Google Sheet 2触发Google Sheet 1的功能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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