繁体   English   中英

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

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

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

有没有人有任何关于如何使这个开心的问题?

我试过使用库函数。 我不确定我是否正确地做到了。

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

就在这里。 Publish是G Suite Editor插件。 有关详细信息,请参阅https://developers.google.com/gsuite/add-ons/overview

有关

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM