In my Google Sheets spreadsheet I set the Protection for some of the cells so that "Only You" can edit (only myself can edit, but the dialog text reads "only you"). Other cells do not have any protection. I would like to be able to run a script which adds a thick red border around each cell that has protection, or if that is not possible, add the border on every cell that is does not have any protection. I have tried various scripts but I have only found how to set the protection not determine whether or not the cell is protected because if I (myself) can edit, then since I can edit all the cells in the spreadsheet, the script cannot differentiate cells that have no protection from cells that have protection but I can edit.

1 Answer 1


Use getProtections(type)

Gets an array of objects representing all protected ranges or sheets in the spreadsheet.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.