I'm trying to use GAS to freeze the top row of each sheet. It works, freezes the desired rows, but returns an error:
"TypeError: cannot call method setFrozenRows" of undefined (line6, file "freezeLabelRows")
According to Google documentation, the syntax is correct.
I'm running the script from the code editor attached to the sheet where I'm developing the app.
I tried a number (1) where numRowsFr is now; that was a workaround I used to dodge this error.
function rowFreeze() {
var numSheets = SpreadsheetApp.getActiveSpreadsheet().getNumSheets();
for(var i = 0; i <= numSheets; i++) {
var frSheet = SpreadsheetApp.getActiveSpreadsheet().getSheets()[i];
var numRowsFr = 1;
frSheet.setFrozenRows(numRowsFr);
}
}
As I said, the code works to freeze the desired row on each sheet, but returns an error. I'd like to get the rest of this app in place to upgrade for current users.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…