5

I have a Google spreadsheet that I need some people to edit certain parts, so they need edit permission. I have locks on virtually everything else (except things like adding a sheet, but that won't break anything). The problem is that I use quite a few scripts, and I don't know how to block these users from editing them. Is there any way to protect these scripts from being edited from everyone except me?

1

Bounded projects inherit permissions from the container so users with edit access to the spreadsheet will have edit access to the code in the bounded project.

One alternative to protect the code is to move to a library. Another alternative is to create an add-on.


References
Collaborating with Other Developers - Google Apps Script

1

Late to the party, but for anyone coming across this question in the future, my workaround for this was to use a standalone script. Triggers can be created programmatically using the spreadsheet ID (instructions here).

Original post: How can I protect an Apps Script with triggers and authorizations in a shared Google Sheet?

1

I wonder why this question hasn't got a decent answer yet after more than 4 years.

It's surprisingly simple :-) Just create a new script (standalone, or under another spreadsheet), and replace all the SpreadsheetApp.getActiveSpreadsheet() calls by SpreadsheetApp.openById("spreadsheet-id") in which the spreadsheet-id is the last part of the document URL; https://docs.google.com/spreadsheets/d/{spreadsheet-id}

Using this easy trick, you access the shared spreadsheet by your own script that is not accessible to the others.

New contributor
Ehsan is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.