1

I have

  • an Apps Script Library 'MyLib'.
  • template Google Spread Sheet ('MyGSSheet'). Through Script Editor I added the library 'MyLib' to 'MyGSSheet'. I set 'Development mode' 'on'.
  • users get a 'copy' of this template ('MyGSSheet').

How can I have a setup wherein any changes I make to 'MyLib' get picked up across these copies automatically (once the Spreadsheet is reloaded)?

I thought having 'Development mode' 'on' is all that's needed for this continuous update of the code in all the Spreadsheets. However, I don't see this happening. The copies aren't picking the latest code. I also granted 'edit' permission to all users within our company domain.

2
  • Did you save your most recent code as a new version? Commented Sep 10, 2017 at 1:25
  • No, I didn't save it as new version. I am trying to avoid having the clients update (the library version) every time I make a code change in the library. Commented Sep 10, 2017 at 1:46

1 Answer 1

1

I am not able to comment so I hope I am contributing enough to justify an answer..

So I tried to reproduce this:

I created a standalone App Script 'MyLib' and wrote a single function:

function myFunction()
{
  SpreadsheetApp.getUi().alert("TEST");
}

Next I created a spreadsheet and added a script to it via Tools. I'll call it "Spreadsheet Script".

In the Spreadsheet Script I added the MyLib as a library and turned the development mode 'on'. Also I added two functions to Spreadsheet Script:

 function onOpen(e)
 {
   myFunction();
 }

 function myFunction()
 {
    MyLib.myFunction();
 }

Ok, now I shared the Spreadsheet and the MyLib - script to my colleague with edit rights. He opened the spreadsheets and got the alert "TEST".

Now when I modified the alert text from the MyLib-script's myFunction to "TEST 2 " and just saved the file (File/Save, did not save a new version), my colleague saw the changes in the spreadsheet. Then, I made him to take a copy of the spreadsheet( To test the effect of the spreadsheet owner change). I changed the alert the text to "TEST 3". The change was reflected in his copy of the spreadsheet.

Are you able to reproduce this or does this approach fail to update for the other users? I am choosing this kind of simple example as sometimes the reason might reside in the code too...

Sign up to request clarification or add additional context in comments.

3 Comments

Thank you for your help. My bad. The block of code that was expected to reflect in the Spreadsheet was preceded by a subtle return statement/condition. In other words, the control wasn't coming to the code block. Sorry about the trouble. It looks I also don't need to give Edit access to all potential users (i.e., across our company domain).
Oh? You mean by you or only you?
I can see the updates. And, once I gave 'Edit' access to "those with the link, within our domain", all the users of all the Spreadsheet copies are able to see the code updates.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.