Search code examples
pythongoogle-sheetspygsheets

How can I set domainUsersCanEdit to False in a protected range?


I can edit the list of editors of a protected range just fine. When I create a new protected range, however, it has by default domainUsersCanEdit property set to True. How can I set it to false?

Also, related question: using Google UI you can protect the whole worksheet without setting an arbitrary range in it. Is this possible to do with pygsheets?

I failed to find answers for the above in the official API docs.


Solution

  • The domainUsersCanEdit is set by default by the api. You can make it false by

    range.editors = ('domainUsersCanEdit', False)
    

    Also, related question: using Google UI you can protect the whole worksheet without setting an arbitrary range in it. Is this possible to do with pygsheets?

    Not at the moment, please raise an issue for the same.

    NB: Please update your pygsheets from the github staging branch