1

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?

Rubén
  • 34,714
  • 9
  • 70
  • 166
Let Me Tink About It
  • 15,156
  • 21
  • 98
  • 207
  • I have to apologize for my poor English skill. I cannot understand about `I want to push the latest changers to the subscribers without the users needing to take any additionals steps beyond, perhaps, some initial approval.`. Especially, I cannot understand about `without the users needing to take any additionals steps beyond, perhaps, some initial approval.`. Can I ask you about the detail of it? – Tanaike May 06 '20 at 06:51
  • @Tanaike: To put it a different way... Usually, a library user needs to manually update the version of every library they use by opening the libraries dialog under the resources tab menu. I want to avoid the user needing to make a manual update and automatically push the new version out to them so they are always working with the most recent update. – Let Me Tink About It May 07 '20 at 02:25
  • Thank you for replying. In that case, you want to always make users use the latest version of the library without using the developer mode. Is my understanding correct? – Tanaike May 07 '20 at 02:44
  • @Tanaike: Yes. That is correct. – Let Me Tink About It May 07 '20 at 03:53
  • 1
    Thank you for replying. From your replying, I proposed a workaround as an answer. Could you please confirm it? If I misunderstood your goal and that was not the direction you want, I apologize. – Tanaike May 07 '20 at 04:49
  • Am I right in supposing every single function in the development library must be reflected in the user library? In other words every time a new function is added in the developer library then it must also be added in the user library. – michaeldon Mar 07 '22 at 16:24

2 Answers2

5

From your replying comment, I could confirm your goal as follows.

  • You want to always make users use the latest version of the library without using the developer mode.

For this, how about this answer?

In this answer, I would like to propose a workaround using 2 libraries.

Usage:

1. Create 2 standalone scripts.

Please create 2 standalone scripts. In this case, those are the script "A" and "B".

  • The script "A" is used as the library the users use.
  • The script "B" is used as the library for using at the script "A".

In this case, the users use the script "A" as the library. You develop the library by modifying the script "B".

2. Setup library you develop.

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;
}

3. Setup library users use.

  1. Copy and paste the following script to the script "A".

    function myFunction(e) {
      return lib.myFunction(e);
    }
    
  2. Install a library of the script "B". Please turn on "Development mode". In this case, it supposes that "Identifier" is lib.

    • By this, when you modified the script "B", this script "A" can use the latest script you modified.
    • This is uses as the wrapper library for achieving your goal.
  3. Give the version to the script "A" at "File" -> "Manage versions" on the script editor.

4. Install library at user side.

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.

Tanaike
  • 181,128
  • 11
  • 97
  • 165
1

Generally speaking the answer is no: users will always have to select the version they want to use from the Resources > Libraries... menu. In the specific situation where your users have edit access to the library script they can use always the last version switching on the developer mode.

Anyone who has editor-level access to the script has the latest changes made to the files in the library project even if it was not saved as a version.

Reference:

Libraries

Alessandro
  • 2,848
  • 1
  • 8
  • 16