简体   繁体   English

有没有办法在多个不同的工作簿中使用相同的google-app-script?

[英]Is there a way to use the same google-app-script in multiple different workbooks?

I have created 20+ Goolge Sheets workbooks. 我创建了20多个Goolge Sheets工作簿。 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. 我想做的一件事就是不要在每一个中运行20多个代码,我希望在我的每个工作簿中都使用一个代码。

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()" />

Yes, there is. 就在这里。 Publish is as G Suite Editor add-on. Publish是G Suite Editor插件。 For details please read https://developers.google.com/gsuite/add-ons/overview 有关详细信息,请参阅https://developers.google.com/gsuite/add-ons/overview

Related 有关

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用JDBC和Google-App-Script对多个查询保持连接状态? - How can I keep my connection alive for multiple queries using JDBC and Google-App-Script? 如何结合两个功能google-app-script? - How to combine two functions google-app-script? 通过google-app-script创建DCM报告 - creating DCM report through google-app-script Google-App-Script vs PHP编码为base64 - Google-App-Script vs php in encoding base64 google-app-script 暂停键控输入/箭头键 - google-app-script Pause for keyoared input/Arrowkey google-app-script 如何将所有 blob 合并为一个 blob - google-app-script how to cocat all blob into one blob Google-App-Script 条件循环正在运行但未按预期运行(java 脚本) - Google-App-Script Conditional Loop is running but is not behaving as expected (java script) 如何使用 Google-App-Script 将自定义属性分配给 Google Slides 内容 - How to assign custom properties to Google Slides contents using Google-App-Script 在我的情况下,如何自动运行google-app-script? 设置触发器就足够了吗? - How to automatically run a google-app-script in my case? Is setting a trigger is enough? Google-app-script:使用电子表格中的单元格行[]的JavaScript电子邮件正文中的日期格式问题 - Google-app-script: Date formating issue in a javascript email body using a cell row[] in Spreadsheet
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM