When I saw both your Spreadsheet and your sample image, I thought that the values of "#REF!"
and ""
are required to be used. I think that the reason of your current issue might be due to this. So in your script, I think that it is required to add one more condition to the function shouldHideRow
as follows.
Modified script:
function shouldHideRow(ss, rowIndex, rowValue) {
if (rowValue == "" || rowValue == '#REF!') return true; // <--- Added
if (rowValue != '') return false;
- By this modification, when the cell value is
"#REF!"
and""
,sheet.hideRows(startRow + i)
is run.
CLICK HERE to find out more related problems solutions.