I new to scripting and have a range of data 3 columns wide which I would like to add borders to based on column 1. I need to check to see if the cell (cells) immediately below is a blank or non-blank cell. If the cell (or cells) below are blank I want include those cells when setting the border but having some issues. Any help would be appreciated.
I have tried something like this but no luck
var range = sheet.getRange(row,1, totalrows,3);
var data = range.getValues();
for (i=0; i<data.length; i++) {
if(data[i][0] != "" &&
data[i+1][0] != "")
{
sheet.getRange(i,1,1,3).setBorder(true,true,true,true,true,false);}
}
sheet, rows and totalrows have been defined earlier
any help would be appreciated