• Register
0 votes

Problem :

I am having some very strange problems with the protection in Google New Sheets.

I have protected my sheet for edit by owner only except for the rows 5 to 7 using the 'Sheet protect except certain cells' function under the 'Data - Protected sheets and ranges...'

I have also used the simple User Function menu which can be invoked on open that contains the simple Google Apps Script that will insert a given number of rows. The following things are happening when the other user tries to access the sheet:

1.      The basic protection seems works as expected. The other user can only edit the rows 5 to 7.

2.      The insert row function which I selected under User Functions menu produces the 'Service error: Spreadsheets'.

3.      And if the other user tries to delete any of the 3 unprotected rows then the message as follows: 'Can't save your changes. Copy any recent changes, then revert to an earlier version...'  will appear in the red box at the top of the screen. By clicking on the top 'revert to an earlier version...' link will reverse the delete.

If I remove all the protection then everything is 100% for the other user - insert rows function - delete rows etc.

6 5 3
7,540 points

1 Answer

0 votes

Solution :

You need to set up the project trigger for onOpen() rather than the use of  the simple onOpen(). Then it will run with the required privileges rather than those of the current user. So just click on the Resources/Current Project Triggers and add a new trigger. And you are sorted.

9 7 4
38,600 points

Related questions

0 votes
1 answer 116 views
Problem : How can I ignore the below error message on the Git pull? Your local changes to the following files would be overwritten by merge What if I just want to overwrite them? I Have already tried many things like git pull -f, but nothing really works for me.To be very clear, I just want to overwrite the specific changes and not the everything.
asked Jan 2 alecxe 7.5k points
0 votes
2 answers 91 views
Problem : I have the project with two branches as staging and beta. I try to develop on staging, and use my master branch to fix the bugs. git checkout master And do the stuff on it : git add fileToAdd git commit -m "bug fixed ... be overwritten by checkout: src/Pro/ConvocationBundle/Controller/DefaultController.php Please, commit your changes or stash them before you can switch branches. Aborting
asked Dec 18, 2019 alecxe 7.5k points
0 votes
1 answer 2.1K views
Problem : As I am allowing the USB debugging, when I tap on OK button, the Messaging pops up as follows: Because an app is obscuring a permissions request, Settings can't verify your response The above error is coming in allowing USB debugging.
asked Dec 10, 2019 alecxe 7.5k points
0 votes
1 answer 54 views
Problem : I am getting bellow error if we're in the real pre-commit handler we can't actually add any new fences due to ca restriction
asked Nov 7, 2019 peterlaw 6.9k points