2

How can I call an external Google Web App script from within my script in a Google spreadsheet container? I have a number of spreadsheets that are created dynamically and would like them all to call a single Web App for uniformity and ease of maintenance.

0

2 Answers 2

2

Have a look at this blog post: Trigger updates between master – slave spreadsheets Basically what you want to accomplish in the same, in the specific scenario the master spreadsheet is actually a web app (web service) for all the slave spreadsheet documents.

Sign up to request clarification or add additional context in comments.

1 Comment

Site has gone. Domain redirects to some malware which tries to change your Chrome default search engine.
1

You are describing a textbook use of Google Apps Script Libraries! Start by reading Introducing Versions and Libraries in Apps Script.

Your master script, plus any utilities you want to access, needs to be set up as a library, for example let's say it's called MyLib. Your dynamically created (client) spreadsheets then access functions that are in MyLib by treating it as a javascript object. For example, a function calcValues() would be referenced like this:

...
var result = MyLib.calcValues(dataRange);
...

You didn't ask this, but just in case you're thinking of using custom functions (as described in Custom Functions in Spreadsheets) that are implemented in your library / master script, you will need to provide wrapper functions in your client spreadsheets. Here's that same example as a wrapper:

function calcValues (dataRange) {
  return MyLib.calcValues(dataRange);
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.