Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to protect a sheet via Google Sheets API?

I see we have AddProtectedRangeRequest, but I want to protect the whole sheet just like you can do through the UI. Any ideas? Thanks!

like image 597
Jim Ott Avatar asked Oct 27 '25 15:10

Jim Ott


1 Answers

From the docs for ProtectedRange.range: The range that is being protected. The range may be fully unbounded, in which case this is considered a protected sheet.

So if you only set the range's sheetId and leave the start/end row/col empty (e.g unbounded), it will protect the whole sheet.

like image 123
Sam Berlin Avatar answered Oct 29 '25 09:10

Sam Berlin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!