I have a spreadsheet, and I have shared it with 50 people for the editor role. I have written some js codes in app script but unfortunately, someone removed my code and the spreadsheet has been affected for the reason.

I need a solution so that no one views or accesses my app script code who has an editor role.

  • 1
    this does not send a message to Rubén ... please post a complete question about your problem ... someone will try to answer it ... include a description of what you tried, a description of what you do not understand and a description of any errors that you observed
    – jsotola
    Commented Aug 14, 2022 at 20:59
  • I defer to @Rubén for a definitive answer/comment. In the meantime, I think I can clarify that the focus is not multiple spreadsheets (per se) but multiple projects. There aren't necessarily two spreadsheets but there are two projects. One project is bound to the "target spreadsheet"; this may or may nor contain code and any editor can view that code. But the second project (which need not be bound to a spreadsheet at all) references the "target spreadsheet" by ID. Editors of the target spreadsheet won't easily find the second project, so the code is effectively hidden from them.
    – Tedinoz
    Commented Aug 15, 2022 at 3:45
  • Hi, welcome to WebApps. Your question needs to stand on its own. Even though you reference a related question, you need to write a question that explains the problem in as many words. @jsotola was right to ask for a complete question and your response of "you can follow the question title and that I need an answer." is inappropriate.
    – Tedinoz
    Commented Aug 15, 2022 at 3:50
  • @Tedinoz question is updated!
    – Jebra
    Commented Aug 15, 2022 at 8:07
  • 1
    Follow up questions should be posted as new questions, not as an edit of a question that already was answered. Commented Aug 15, 2022 at 16:25

1 Answer 1


There are several ways to protect a script from users who have editor access to the spreadsheet, depending on the nature of the script.

If the script runs when a time-driven trigger fires, it can be implemented as a stand-alone script project that nobody else has access to.

If the script contains UI code such as dialog boxes or sidebars, you would have to rewrite the script as an add-on.

The third option is to implement the script as a library with only a few short stub functions in the script project that is bound to the spreadsheet, and the rest of the code in the library.

  • thanks for the peaceful suggestion. Which one do you recommend as the most secure way?
    – Jebra
    Commented Aug 15, 2022 at 8:49
  • An add-on. There is a learning curve. See Apps Script at Stack Overflow. Commented Aug 15, 2022 at 11:40

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