Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Users For Protected Ranges #1072

Open
tompbarry opened this issue Jun 29, 2022 · 2 comments
Open

Add Users For Protected Ranges #1072

tompbarry opened this issue Jun 29, 2022 · 2 comments
Assignees

Comments

@tompbarry
Copy link

Is your feature request related to a problem? Please describe.
After copying a spreadsheet using client.copy and then opening the new sheet using client.open, the protected ranges are still correctly defined as in the source spreadsheet; however, the Editors for the protected ranges have been changed to just myself.

Describe the solution you'd like
I would like to be able to add the other users that had edit rights to protected ranges on the new sheet.

Describe alternatives you've considered
I've considered deleting and redefining the protected ranges so more than one editor can be added; but that seems like it's not needed.

The com.google.api.services.sheets.v4.model contains a Class Editors that appears to allow additions/removal of editors for protected ranges as shown at https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/sheets#Editors

Google Apps Script also contains an addEditor https://developers.google.com/apps-script/reference/spreadsheet/protection?hl=en#addeditorsemailaddresses function for protected ranges.

Additional context

@lavigne958 lavigne958 self-assigned this Jul 1, 2022
@lavigne958 lavigne958 added Feature Request Need investigation This issue needs to be tested or investigated labels Jul 1, 2022
@lavigne958
Copy link
Collaborator

Hi thank you for raising this issue.

I checked and I confirmed the protected ranges are not copied over to the new spreadsheet.

I can work that out and add a new option to the copy method and offers to copy the protected ranges. This will be costly though. Much like the other (already existent) options, we need to list all protected ranges then created them by batch (if the API allows it by batch, otherwise it will be one by one).

I am adding this feature to the next release.

@lavigne958 lavigne958 removed the Need investigation This issue needs to be tested or investigated label Jul 16, 2022
@lavigne958 lavigne958 added this to the 5.5.0 milestone Jul 16, 2022
@lavigne958
Copy link
Collaborator

Hi @tompbarry
I had a look at this issue, I have a draft code that does the job but the API has some issues.
When sending the request to create the new protected ranges it fails, every time I try to copy the original protected range to the new sheet, the new sheets ends up with 2 protected ranges, one that has an issue and we can't delete it/edit it, the other one that is only read-only.

I am removing this issue from the next milestone as I have no idea how to counter that problem for now.
I will keep track of that and keep testing.

@lavigne958 lavigne958 removed this from the 5.5.0 milestone Aug 10, 2022
@alifeee alifeee added this to the 6.0.0 milestone Aug 8, 2023
@alifeee alifeee removed this from the 6.0.0 milestone Oct 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants