So I'm currently working on Protected sheets & ranges. Scripts are included with this. The thing is I have these two buttons which are the Lock and Unlock.
Everything works fine on the owner's side. So, if we will view this as the user or client-side:
The Lock button functions as it removes the protected range setting that is created by the owner then creates a new setting that disables all the range from editing. The lock button is accessible by the owner and editors.
The Unlock button functions as it removes the settings that the lock button has been created and then create settings that have the "except certain cells" for the ranges that need to be editable. So, for the user side, I'm thinking that this button will only be accessible by the owner. The owner is the only one who can use the unlock button for security.
So the thing is when clicking the lock button on the user side, it gives me an error that says...
> Exception: You are trying to edit a protected cell or object. Please contact the spreadsheet owner to remove protection if you need to edit.
But I think I figured out the problem. The error shows when the user is not the one who created the said setting. In short, when the owner is the one who creates the protected settings, the user can't edit it.
So, I'm trying to figure out how can the editors use the two buttons without receiving that error. I'm new to this area so I don't have an idea on how to exactly execute this thing. As the owner, I need to create the settings before the user can open the file and be the one who can only unlock the sheet for security purposes.
Here's the visual of the thing that I'm working on...
Capture.JPG
Here's the code that I'm currently using
Bookmarks