有没有办法在多个不同的工作簿中使用相同的google-app-script? [英] Is there a way to use the same google-app-script in multiple different workbooks?

查看:68
本文介绍了有没有办法在多个不同的工作簿中使用相同的google-app-script?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了20多个Goolge Sheets工作簿.我还编写了脚本来运行每个脚本.我想做的一件事是,而不是每个代码中都要运行20多个代码,我希望每个工作簿中都使用1个代码.

I have created 20+ Goolge Sheets workbooks. I have also written scripting to run each one. The one thing I would love to do is instead of have 20+ codes to run in each one, I would like to have 1 code that was used throughout each of my workbooks.

有人在现场制作这种玩具吗?

Does anyone have any insite on how to make this happpen?

我尝试使用库函数.我不确定我是否做得正确.

I have tried using the library function. I am not sure if I am doing it correctly though.

**//This is my Menu//**

function onOpen() {

var submenu = [{name: "Submit Order", functionName: "SubmitOrder"},
{name: "Recommended Order", functionName: "myRecommendations"},{name: "Clear Entire Form", functionName: "ClearAllCells"},
  {name: "Clear Product Information", functionName: "ClearProductCells"},{name: "Notifications", functionName: "showSidebar"}];
  SpreadsheetApp.getActiveSpreadsheet().addMenu('OTSR Tools', submenu); 

  }

function showSidebar() {
  var html = HtmlService.createHtmlOutputFromFile('Page')
      .setTitle('Notifications')
      .setWidth(500);
  SpreadsheetApp.getUi() // Or DocumentApp or SlidesApp or FormApp.
      .showSidebar(html);

   }

**//This is the HTML for my Sidebar//**

Hello everyone,<br>
Your quote of the week is...<br>
<br>
<i>"Our greatest weakness lies in giving up. <br>
The most certain way to succeed is always to try just one more time."</i><br>
<br>
Thomas A. Edison<br>
<br>
If there are any updates they will be found below.<br>
<br>
This is a Test!!!!!!!!!<br>
<br>
Thank you,<br>
<br>
Jason Mattson<br>
Back-End Support"<br> 
<br>
<input type="button" value="Close" onclick="google.script.host.close()" />

推荐答案

是的.发布是G Suite编辑器的附加组件.有关详细信息,请阅读 https://developers.google.com/gsuite/add-ons/概述

Yes, there is. Publish is as G Suite Editor add-on. For details please read https://developers.google.com/gsuite/add-ons/overview

相关

  • Google Apps script publishing addon for internal use
  • Publish an add-on privately

这篇关于有没有办法在多个不同的工作簿中使用相同的google-app-script?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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