This question already has an answer here:
How To Have One Script In multiple containers? [duplicate]
(1 answer)
Closed 4 years ago.
I have created a script through Google Apps Script that resides in a Google Document. I use that document as a template object, which is then copied into many Google Documents where I use those script functions.
Problem is, whenever I edit that Master Script, all the child documents have an outdated script that must be updated manually.
Is there a way to have a base master script file that I can reference in the template, and thus in all the child documents from that template? Seems like the only ways to do this are to create an Add-On, but that wouldn't seem to resolve the need for constant updating of the script.
Add-ons do provide auto-update functionality. I'd go down that route. Additionally, you can choose to only publish to yourself if you wish.
As for your question about republishing, you can update your published add-ons.
Related
This question already has answers here:
How to share or distribute google apps script with other users?
(2 answers)
Closed 1 year ago.
I have done my app script for test google sheet.
Now I want to import this app script in another google sheet.
I can copy all code to new app script,
but it seems not a good way and a little stupid.
Is there any better way?
You've got two options
Build a library, this will allow you to easily integrate your code in any spreadsheet
Build an add-on; this is slightly more complex, but will allow your users to use a UI to run your scripts without ever needing to use an editor. In your case it's probably best to use this option if you have a Workspace account, this way you can build a private add-on
This question already has answers here:
How to protect the Apps Script code in a Google spreadsheet?
(6 answers)
Closed 5 years ago.
Can I open access to the sheets for editing, with the ability to run scripts. But do not give access to viewing and editing scripts?
Or how can I give users access to run scripts without changing them?
Yes, this is easily done. However, from experience, ensure you extensively test your scripts and add all the necessary error handling before distributing it.
Basically, what you need to do it create a new standalone script file, save a version and then distribute the project key to your users or if you are creating a template that the user will make a copy of then call the functions in the script editor of the template file.
Google Documentation on creating librarys
Google Documentation on creating a version
This question already has answers here:
How to protect the Apps Script code in a Google spreadsheet?
(6 answers)
Closed 5 years ago.
I have ID key of the master script and I have did connecting it to another users spreadsheet template as a Library but what I want to do is How to make the spreadsheet template access to the master script being limited or should be not shared.
When I'm going to deleted a master script even the library still appears on the list of clien script of the spreadsheet template but all function seperate dead completely or it has said like this:
YOU DO NOT HAVE ACCESS TO LIBRARY *******, USED BY YOUR SCRIPT, OR IT HAS BEEN DELETED.
Try coment from #user3887038 in Q16075446. It make possible to hide library code, but it made difficult to updating code
This question already has answers here:
How to allow access for importrange function via apps script?
(5 answers)
Closed 8 months ago.
Using Google scripts, I'm creating a bunch of spreadsheets each of which contains an importrange function. In new google sheets one needs to allow access for that importrange to fetch data from a source file - I was wondering whether it was possible to make it automatic using Google scripts and get round the need to press "allow" manually each time?
It is definitely possible to write an importrange function in Apps Script, but you'll need to run it too, so I don't know if it's going to be any better than clicking "allow".
I guess that, depending on your use-case, you could write a single script in the source sheet that pushes the data to the other sheets and possibly even create them automatically for you. Therefore saving you this click per sheet and possibly some other clicks. We can surely help you here in StackOverflow, but it's mostly working out problems, you'll have to put in some effort to develop it yourself. Take a look at Apps Script page to get started.
I was facing the same issue and I don't think access can be granted through script. It needs to be done manually in each spreadsheet.
Best part is it needs to be done only once in any spreadsheet then it will update automatically.
This question already has answers here:
How to protect the Apps Script code in a Google spreadsheet?
(6 answers)
Closed 6 years ago.
Is there a way to keep your GAS code a secret? I'm needing to keep some code in a spreadsheet secret.
Thanks in advance.
Maybe you can make your script separate from the spreadsheet. Then import it as a library. I believe that keeps your code private.
Just as a note, it seems that anyone with edit access to a spreadsheet also has edit access to the script associated with the spreadsheet.
You can do this via a share, but it is not easy. Share the document with another account, the other account is then able to access the spreadsheet. You can trigger the script in the other account via a URL. I have done this before, it does work.