wils484
wils484

Reputation: 275

How to make a call from one Google Apps Script to a function in another?

Is there an easy way of making a call from one Google Apps script to a function in another?

I'm writing two scripts, one which should use functions from the other. I want the two to have different sharing permissions, however, so I don't want to put them in the same project.

I can't seem to find any "require Xxx.gs" type function in the documentation.

I found this: Call functions from another "class" / file

But I get "xxx function not found" errors if I try to call a function from a different file.

Upvotes: 5

Views: 13753

Answers (2)

Zig Mandel
Zig Mandel

Reputation: 19864

Besides libraries, if you actually want to keep the projects separate you can publish a service url and use parameters to call it from the other script with urlFetch, as in myserviceurl?call=myfunction&param1=x

Upvotes: 1

Serge insas
Serge insas

Reputation: 46822

As Corey mentioned in the post you refer to you need to use libraries to do what you want. You can not use functions from another project in a project (but you can of course use any function from different script files inside a project)

Upvotes: 7

Related Questions