How to Iterate through cells within particular columns

232 views Asked by At

I have a spread sheet and I am trying to set a backColor for cells with empty values of some particular columns. Presently, I can iterate through the spread sheet and set the backColor for all cells with empty values, but I want to narrow it down to only check particular columns. For instance if I have columns Name, Location, Age, Net worth, Occupation. I want to loop through cells within Age and Occupation columns alone, instead of all.

1

There are 1 answers

0
MESCIUS Team On

I think a better option than iterating through cells is to apply the formatting to the range. For example getRange("C:C").backColor("red"); would set the background to red for the whole column.

if you only want to set empty values, then conditional formatting would be better.