How do I change the height of multiple rows at once via Google Apps Script?
Attempt:
function resizeHeight() {
var s = SpreadsheetApp,
ui = s.getUi(),
sh = s.getActiveSheet(),
curntRow = s.getActiveRange().getRow(),
rowsMany = s.getActiveRange().getNumRows(),
autoRangeRows = s.getActiveRange().getA1Notation().replace(/[a-z]/gi,""),
getVal = ui.prompt('⿱⇕', 'Change the height of row❓ Cancel. Back to default❗ (21)', ui.ButtonSet.OK_CANCEL),
Btn = getVal.getSelectedButton(), Txt = getVal.getResponseText();
for (var i=curntRow; i<=rowsMany+1; i++) {
if (Btn == 'OK') {
if (autoRangeRows.search(":") == -1) {sh.setRowHeight(curntRow, Txt);}
else {sh.setRowHeight(i, Txt);}
}
if (Btn == 'CANCEL') {
if (autoRangeRows.search(":") == -1) {sh.setRowHeight(curntRow, 21);}
else {sh.setRowHeight(i, 21);}
}
}
}
Problem:
The script is not very effective they only work on the part or a few rows but not on all rows can be implemented.