• Register
0 votes
39 views

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

Please log in or register to answer this question.

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 1 view
1 view
Problem: How do I add formulas to Google Sheets using Google Apps Script?
asked 19 hours ago Humaira ahmed 15.1k points
0 votes
1 answer 1 view
1 view
Problem: I want to create a new sheet in Google Sheets with Google Apps Script, I just want to create a new sheet with a specific name.
asked Apr 3 Jack20 3k points
0 votes
1 answer 4 views
4 views
Problem: I have multiple columns - G, L, Q, V, AA, AF - to which I want to apply a conditional format rule in Google sheets. Starting in row 2 - so that I don't include the header row - I want any given cell in the specified column to . ... I have been looking around for some time online and have not found a solution to my problem. Any help would be greatly appreciated! Thank you!
asked Mar 26 Shovo210 14k points
0 votes
1 answer 2 views
2 views
Problem: I am stuck with this ... Please help me that how to deal with this? Insert a page break in google sheets
asked Apr 4 Ifra 24.4k points
0 votes
1 answer 1 view
1 view
Problem: Please help me … how can I solve it? google sheets highlight row based on cell
asked Mar 26 Ifra 24.4k points
0 votes
1 answer 7 views
7 views
Problem: Can anyone tell me the solution of this problem? how many lines of text are in your questionnaire document
asked Mar 25 Ifra 24.4k points
0 votes
1 answer 2 views
2 views
Problem: How to automatically copy and paste cells Google Sheets?
asked 3 days ago Humaira ahmed 15.1k points
0 votes
1 answer 2 views
2 views
Problem: I need help in resolving this problem: a formula or sheet you want to move or copy contains the name
asked Apr 1 rakib1 51.5k points
0 votes
1 answer 2 views
2 views
Problem: I am stuck during learning as I have already mentioned in my question someone please cooperate me to continue my project-Thanks
asked Mar 23 shamimkhan 15.1k points
0 votes
1 answer 2 views
2 views
Problem: Is anyone available to assist me and resolve this issue? how to create a reminder in google calendar
asked Apr 6 Ifra 24.4k points