客户端应用程序脚本库自动更新(在文档刷新上)? [英] Apps script library automatic updation on client side (on doc refresh)?

查看:125
本文介绍了客户端应用程序脚本库自动更新(在文档刷新上)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有


  • Apps脚本库'MyLib'。

  • 模板Google Spread Sheet ( 'MyGSSheet')。通过脚本编辑器,我将库'MyLib'添加到'MyGSSheet'中。我在''上设置'开发模式''。

  • 用户获得此模板的'副本'('MyGSSheet')。



我如何设置一个设置,其中我对'MyLib'所做的任何更改都会自动从这些副本中提取出来(一旦电子表格重新加载)?

我认为在'所有电子表格中的代码不断更新需要'开发模式''。
但是,我没有看到这种情况发生。副本不选择最新的代码。
我也授予我们公司域中所有用户的'编辑'权限。

解决方案

我无法评论所以我希望我的贡献足以证明一个答案。



所以我试图重现这一点:



我创建了一个独立的应用程序脚本'MyLib'并写了一个函数:

  function myFunction()
{
SpreadsheetApp.getUi()。alert(TEST);
}

接下来,我创建了一个电子表格并通过工具为其添加了一个脚本。我将它称为电子表格脚本。



在电子表格脚本中,我将MyLib添加为库,并将开发模式设置为开启。
此外,我还为电子表格脚本添加了两个函数:

 函数onOpen(e)
{
myFunction();
}

函数myFunction()
{
MyLib.myFunction();
}

好的,现在我将电子表格和MyLib脚本分享给我的同事编辑权限。他打开电子表格并获得了测试警报。

现在,当我将MyLib脚本的myFunction中的警报文本修改为TEST 2并保存了文件(文件/保存,未保存新版本) ,我的同事看到了电子表格中的变化。然后,我让他拿出电子表格的副本(测试电子表格所有者更改的效果)。
我将警报文本更改为测试3。这一变化反映在他的电子表格副本中。


您是否可以重现此操作,或者此方法无法为其他用户更新?我选择了这样一个简单的例子,因为有时候这个原因也可能存在于代码中......


I have

  • an Apps Script Library 'MyLib'.
  • template Google Spread Sheet ('MyGSSheet'). Through Script Editor I added the library 'MyLib' to 'MyGSSheet'. I set 'Development mode' 'on'.
  • users get a 'copy' of this template ('MyGSSheet').

How can I have a setup wherein any changes I make to 'MyLib' get picked up across these copies automatically (once the Spreadsheet is reloaded)?

I thought having 'Development mode' 'on' is all that's needed for this continuous update of the code in all the Spreadsheets. However, I don't see this happening. The copies aren't picking the latest code. I also granted 'edit' permission to all users within our company domain.

解决方案

I am not able to comment so I hope I am contributing enough to justify an answer..

So I tried to reproduce this:

I created a standalone App Script 'MyLib' and wrote a single function:

function myFunction()
{
  SpreadsheetApp.getUi().alert("TEST");
}

Next I created a spreadsheet and added a script to it via Tools. I'll call it "Spreadsheet Script".

In the Spreadsheet Script I added the MyLib as a library and turned the development mode 'on'. Also I added two functions to Spreadsheet Script:

 function onOpen(e)
 {
   myFunction();
 }

 function myFunction()
 {
    MyLib.myFunction();
 }

Ok, now I shared the Spreadsheet and the MyLib - script to my colleague with edit rights. He opened the spreadsheets and got the alert "TEST".

Now when I modified the alert text from the MyLib-script's myFunction to "TEST 2 " and just saved the file (File/Save, did not save a new version), my colleague saw the changes in the spreadsheet. Then, I made him to take a copy of the spreadsheet( To test the effect of the spreadsheet owner change). I changed the alert the text to "TEST 3". The change was reflected in his copy of the spreadsheet.

Are you able to reproduce this or does this approach fail to update for the other users? I am choosing this kind of simple example as sometimes the reason might reside in the code too...

这篇关于客户端应用程序脚本库自动更新(在文档刷新上)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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