In my Google spreadsheet, I want to protect all cells below a checkbox if it's value is true and unprotect if it's value is false. Every cell in row 3 is a checkbox that this has to work for.
Example Sheet:
+------------+------------+------------+------------+------------+-----
| Column A | Column B | Column C | Column D | Column E | ...
+---+------------+------------+------------+------------+------------+-----
| 1 | | | | | |
+---+------------+------------+------------+------------+------------+-----
| 2 | | | | | |
+---+------------+------------+------------+------------+------------+-----
| 3 | checkbox1 | checkbox2 | checkbox3 | checkbox4 | checkbox5 | ...
+---+------------+------------+------------+------------+------------+-----
| 4 | value1.1 | value2.1 | ... | ... | ... | ...
+---+------------+------------+------------+------------+------------+-----
| 5 | value1.2 | value2.2 | ... | ... | ... | ...
+---+------------+------------+------------+------------+------------+-----
| 6 | | | | | |
+---+------------+------------+------------+------------+------------+-----
| | | | | | |
So if I set checkbox1 to true
, A3:A50 should be protected and unprotected if I set it to false
...same for checkbox2 -> B3:B50 ...checkbox3 -> C3:C50 ...
This should also only work in one specific sheet (let's call it 'sheet1'). I know how I can set protection using a script but I don't know how to create the dynamic ranges.
I hope you can help me with this.