Search code examples
google-sheetsrangerowspreadsheet-protection

How to protect from editing only rows that are odd numbered?


In Google Sheets how do I protect the rows in Column A which are odd from any kind of edits?

I would like to use this function

=ISODD(ROW(A1))

Protected sheets and ranges gives you this by default

Sheet1!A1

I can do this

Sheet1!A1:A1000

which will protect all 1000 rows but how do I use functions in that so I can only use ODD rows.

Here is a picture of that feature:

ODD rows


Solution

  • As mentioned in the comments on your question, I don't believe there is currently any way of manipulating range protection with Google Apps Script.

    So the only option that I can think of is to manually apply the protection to 500 individual cells (in your example).

    A workaround - that is not particularly tidy - is to use data validation to thwart (ultimately not prevent) entering data in even rows, with this sort of arrangement (accessed from Data, Validation...):

    Data validation example

    Savvy users who have access to the spreadsheet will be able to go in to data validation and circumvent this, though.