I have a Google Apps Script library. Several other users are subscribed to the library. When I update the library, I want to push the latest changes to the subscribers without the users needing to take any additionals steps beyond, perhaps, some initial approval.
Is this possible? If so, how?
From your replying comment, I could confirm your goal as follows.
For this, how about this answer?
In this answer, I would like to propose a workaround using 2 libraries.
Please create 2 standalone scripts. In this case, those are the script "A" and "B".
In this case, the users use the script "A" as the library. You develop the library by modifying the script "B".
Please copy and paste the following script to the script "B". And, please give the version at "File" -> "Manage versions" on the script editor.
function myFunction(e) {
return "ok: " + e;
}
Copy and paste the following script to the script "A".
function myFunction(e) {
return lib.myFunction(e);
}
Install a library of the script "B". Please turn on "Development mode". In this case, it supposes that "Identifier" is lib
.
Install the script "A" as the library at the user side. At that time, please turn off "Development mode". In this case, it supposes that "Identifier" is Lib
. And you can use the following script.
function myFunction() {
const res = Lib.myFunction("sample");
console.log(res) // "ok: sample" is returned.
}
By this, when you modify the script "B", at the script "A", the latest script can be used. On the other hand, users can use the latest library using the constant version without using the developer mode.