function TestFindBlankRow() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sh=ss.getSheetByName('Sheet1');
//Column A to T because you have formula in column U
var Rslt=FirstBlankRange(sh,'A','T'); //0 : If Not Found
Logger.log(Rslt);
var Rslt=NextBlankRange(sh, Rslt, 'A','T'); //0 : If Not Found
Logger.log(Rslt);
var Rslt=LastBlankRange(sh,'A','T'); //0 : If Not Found
Logger.log(Rslt);
};
function FirstBlankRange(Sheet, FirtColumn, LastColumn)
{
for (a=1;a<Sheet.getLastRow()+1;a++)
{
var rr=Sheet.getRange(FirtColumn + a + ':' + LastColumn + a);
var Rslt=rr.getValues().toString();
if ((Rslt.length+1)==rr.getNumColumns())
{
return a;
}
}
return 0;
}
function NextBlankRange(Sheet, CurPos, FirtColumn, LastColumn)
{
for (a=CurPos+1;a<Sheet.getLastRow()+1;a++)
{
var rr=Sheet.getRange(FirtColumn + a + ':' + LastColumn + a);
var Rslt=rr.getValues().toString();
if ((Rslt.length+1)==rr.getNumColumns())
{
return a;
}
}
return 0;
}
function LastBlankRange(Sheet, FirtColumn, LastColumn)
{
for (a=Sheet.getLastRow();a>1;a--)
{
var rr=Sheet.getRange(FirtColumn + a + ':' + LastColumn + a);
var Rslt=rr.getValues().toString();
if ((Rslt.length+1)==rr.getNumColumns())
{
return a;
}
}
return 0;
}