Reputation: 71
I'm trying to deploy my Google Apps Script project, such that it can be used as a library by various different projects connected to a Google Sheet. While my actual project is much larger, I'm unable to even get a simple library to attach to an account under a different email.
I'm deploying the project by clicking 'Publish >
Deploy As Api Executeable..'
I'm selecting 'Anyone' for who has access to the project. I'm then able to successfully add this library using the id under Project Properties >
Project Key when logged in to this email.
However, if I'm logged in to a different email I'm not able to add the library any more. I need people other than me to be able to attach this library to their projects. The error message received is
You do not have access to library ISFOURTEEN, used by your script, or it has been deleted.
The manifest from the published library looks like
{
"timeZone": "America/Los_Angeles",
"dependencies": {
},
"exceptionLogging": "STACKDRIVER",
"executionApi": {
"access": "ANYONE"
}
}
What do I need to change to allow a different user to add the library to their project (assuming they have access to the project key) ?
Upvotes: 0
Views: 943
Reputation: 5706
Libraries and APIs are two distinct entities. Libraries are for storing frequently used code bits while APIs enable you to remotely execute GAS functions in your project without actually exposing the underlying code to the calling application (hence the "Application Programming Interface" acronym).
To use the script as a library, first create the version of your script as described below, then import it using the project key.
https://developers.google.com/apps-script/guides/versions#creating_a_version
You must also share the script file with the other account or make it public.
Upvotes: 1