just.a.guy
just.a.guy

Reputation: 300

google_apps_scripts 2 projects in 1 spreadsheet, call a function in another project

I have a spreadsheet that contains two projects. Call them P1 and P2. There is a function in project P1, that we will cal F1.

I have a function F2, in P2 that is trying to call F1. I receive an error message that F1 is not defined.

code (in P2):

function F2()
{
   var rc = F1();
   Browser.msgBox("returned value: "+ rc);
}

Code (in P1):

function F1()
{
   return "this is a test";
}

Both projects are contained in the same spreadsheet file.

Upvotes: 0

Views: 618

Answers (1)

Srik
Srik

Reputation: 7947

It is not possible for function to be visible across projects. You can only make your functions visible across multiple files in a single project.

To meet your requirement, consider using Libraries ( https://developers.google.com/apps-script/guide_libraries )

Upvotes: 8

Related Questions