question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add ability to protect entire sheet vs. protecting range

See original GitHub issue

Description It would be great to be able to protect an entire sheet vs. just hiding a range. See request below for how to do it:

{
    "addProtectedRange": {
        "protectedRange": {
            "range": {"sheetId": tab_id},
            "warningOnly": False,
            "editors": {"users": ["test@test.com"]},
        }
    }
}

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
lavigne958commented, Mar 10, 2022

you’re right a better documentation should be added, in fact before today I did know you could protect a full sheet and never thought about it but I will add it to the documentation.

thank you very much for helping.

0reactions
juliusdanekcommented, Mar 10, 2022

@lavigne958 this does indeed work. I didn’t understand that from the documentation. Would be great to make that clearer.

I also added a convenience error handler for ranges that are already protected:

    try:
        tab.add_protected_range("", editor_users_emails=["info@sorare.tools"])
    except APIError as api_error:
        #https://stackoverflow.com/questions/4308182/getting-the-exception-value-in-python
        error_dict = api_error.args[0]
        if error_dict["code"] == 400 and "already has sheet protection" in error_dict["message"]:
            return
        raise Exception("Another error occurred")

I saw that you are already working on a method to find protected ranges so I will switch to that one later.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Protect a worksheet - Microsoft Support
To help improve your privacy in Excel, a password adds protection to worksheets to help prevent others from changing, moving, or deleting important...
Read more >
Protect content in a spreadsheet - Google Support
Protect content in a sheet "" ; If you want to protect a range of content: Click Range. Click Select data range ;...
Read more >
Protecting Sheets and Ranges in Google Sheets - YouTube
Learn how to protect entire worksheets and tabs or ranges of cells in Google Sheets with our free tutorial.To get the data source...
Read more >
Preventing Others from Editing the Wrong Cells in a Google ...
To prevent ranges of your spreadsheet from being accidently modified, protect the ranges. You must give another user permission to edit the ...
Read more >
Allow specific users to edit ranges in a protected spreadsheet
Excel offers you an ability to assign user-level permissions to different areas on a protected spreadsheet. You can specify which users can edit...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found