问题
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()" />
回答1:
Yes, there is. Publish is as G Suite Editor add-on. For details please read https://developers.google.com/gsuite/add-ons/overview
Related
- Google Apps script publishing addon for internal use
- Publish an add-on privately
来源:https://stackoverflow.com/questions/55497262/is-there-a-way-to-use-the-same-google-app-script-in-multiple-different-workbooks