本文介绍了在公司网络中为Google表格分配Google Apps脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

开发一个简单的脚本




  • 我的公司使用Google Drive来存储它的文档等。

  • 我们将公司的Google产品数据文件加载到电子表格中,但ImportXML并未满足我们的所有需求。
  • 数据,并将其吐出到打开的电子表格中的当前活动点差。
  • 机制由UI菜单/模式组合控制。

  • ul>

    最后,它能正常工作。




    • 到一个电子表格,但现在我想让其他人访问Google Drive,使用它。



    把它交给我的同事?




    • 如何分配这个脚本,并让它在onOpen() Google表单文档?

    • 我只是想将脚本存储在公司范围内的Google Drives上ve,并让人们安装它或某物,然后通过菜单UI运行。

    • 理想情况下,这意味着我可以随时调整脚本,因为人们正在从脚本相同的源代码。


      我唯一的解决方案是真正让人们将代码复制粘贴到他们自己的文档脚本编辑器中,然后运行onOpen ()手动? (根本不可维护+难以教导)。

      解决方案

      您可以在库中拥有脚本:





      尽管如此,您仍然需要拥有自己的文档(您无权访问)的人员来完成一些工作。他们需要进入Apps脚本代码编辑器,并查找库。



      附加组件可以让人们更容易安装,并且可以发布它仅供私人使用或域名限制。你需要填写一个应用程序来发布一个附加组件,并且文档声明你可以等待几个星期才能找到你。



      如果您有权访问每个人的电子表格并知道其电子表格的名称,并且可以获得授权,那么您可以将所有表格从电子表格中复制出来,将其所有数据插入新电子表格,重命名其旧电子表格,然后将新电子表格重命名为旧电子表格的名称。如果出现问题,您可能希望保留旧的电子表格,但请为其重新命名。您可以使用云端硬盘服务来复制,删除和重命名文件。



      如果程序没有运行,您可能会冒一些数据丢失的风险, t运行正常。



      我没有看到将新代码注入其他人的电子表格的方法。如果可能的话,这可能是一个巨大的安全风险。

      这是一个类似的StackOverflow问题:


      Developing a simple script.

      • My company uses Google Drive to store its documents, etc.
      • We trawl through Google product datafiles in my company by loading them into spreadsheets, but ImportXML wasn't meeting all our needs.
      • So I made a simple Google Apps Script file that handles the data, and spits it out to the currently active spread in an opened Spreadsheet.
      • The mechanics are controlled by a UI menu/modal combo.

      Finally, it works.

      • I've been developing it as a script attached to a spreadsheet, but now I want to let others, with access to the Google Drive, use the thing.

      But how do I get it to my co-workers?

      • How do I distribute this script, and get it to run onOpen() when someone loads a new Google Sheet document?
      • I just want to store the script on the company-wide Google Drive, and let people 'install' it or something, then run it through the menu UI.
      • Ideally that'd mean I can always tweak the script as people are loading the script from the same source.

      Is my only solution really getting people to copy-paste the code into their own documents' Scripts Editor, and run onOpen() manually? (Not at all maintainable + hard to teach).

      解决方案

      You can have a script in a library:

      Documentation - Library

      You would still need people with documents of their own (That you don't have access to) to do some work though. They would need to go into the Apps Script code editor, and look up the library.

      And Add-on would be easier for people to install, and you can publish it for private use or domain restricted only. You need to fill out an application to publish an Add-On, and the documentation states that you could wait for weeks before they get back to you.

      Apply to Publish

      If you have access to everyone's spreadsheet, and know the name of their spreadsheet, and can get authorization, then you could copy all the sheets out of their spreadsheet, insert all of their data into a new spreadsheet, rename their old spreadsheet, and then rename the new spreadsheet to the name of their old spreadsheet. You'd want to keep their old spreadsheet in case something went wrong, but give it a new name. You can Copy, Delete and Rename files with the Drive Service.

      You'd be taking the risk that some of their data is going to be lost if the program doesn't run correctly.

      I don't see a way to inject new code into someone else's spreadsheet. And if that was possible, it could be a huge security risk.

      Here is a similar StackOverflow question:

      Install Apps Script to a Google Sheet

      这篇关于在公司网络中为Google表格分配Google Apps脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-03 00:47
查看更多