AppScript and Access in Sheets [duplicate] - google-apps-script

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

Related

How to share my app script to other spreadsheet? [duplicate]

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

How to Publish/Deploy Google Sheet script as API executable programmatically? [duplicate]

This question already has answers here:
Can I deploy bound scripts using Google Script API
(2 answers)
Closed 2 months ago.
I have a google sheet containing script, I want to perform following operations programmatically.
Make this Google spreadsheet public programmatically.
I want to execute the script associated with the above spreadsheet programmatically for any user (public).
Can I perform "Publish>Deploy as API executable" programmatically?
You may want to check the recent updates in Release Notes and see if it will help. It's stated:
You can now deploy a script project directly from the project manifest.
We've updated the Publish script editor menu item to more accurately represent the various kinds of deployments a project can have, such as add-on, web app, or API executable deployments.
For more information, you may want to check these references:
Using the Execution API
Publishing an Add-on
Then, for features not currently supported, you may check or file a feature request here.

One Google Apps Script referenced by many documents [duplicate]

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.

Use a Library of Google apps script without have access in it [duplicate]

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

How to keep Google Apps Script Secret? [duplicate]

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.