0
votes

I have developed a Google app script where I am generating new google sheet based on a template. After copying the Google sheet, we are changing the owner using setOwner method to specified email address. The requirement is to protect a range thus we use getRange method to select the range and then call protect() method and setDescription to show protect range description.

The issue is we don't want the person who run this script to have edit access. Because s/he is a creator, we tried to change the owner and used removeEditor as well, but it doesn't seem to work.

Thoughts: Is is possible to simuate the File copy run by another user such that the person who is running the script don't have access.

1
Yes, I am using DriveApp to make a copy of Template file.Chetan Sachdev

1 Answers

0
votes

It's not possible to make a protection on such way that the spreadsheet owner will not be able to edit the protected sheet/range.

Bear in mind that only owners and editors are able to run scripts but they can't remove themselves as editors and and editor can't remove the owner.

From https://developers.google.com/apps-script/reference/spreadsheet/protection#removeeditoremailaddress

Neither the owner of the spreadsheet nor the current user can be removed