What setFrozenRows actually does (and doesn't do)
sheet.setFrozenRows(1) tells the Sheets rendering engine to pin the first row to the top of the viewport. Scroll down a thousand rows — row 1 stays. That is the entire job of the call. It does not bold anything, does not add a background color, and does not prevent anyone from typing over your headers. The first time I watched a collaborator accidentally clear a frozen header and then panic-undo through the history, I started wiring in the bold and protect steps by default.
The method lives on the Sheet object, not the Range object, which is the first thing to get straight. You call sheet.setFrozenRows(1), not range.setFrozenRows(1). There is no range-level freeze. If you have multiple sheets in the workbook and want each one frozen, you need to call it on each Sheet separately — getSheets() returns an array you can loop over.