Im building a apps script to process existing data in a spreadsheet, and build new columns of data based on the existing data. How do I find the next empty cell(not the last cell) in any given column?
Here is the code I initially wrote.
function isempty(x, y){
alert(SpreadsheetApp.getActiveSheet().getRange(y, x).isBlank());
return SpreadsheetApp.getActiveSheet().getRange(y, x).isBlank();
}
function nextopencell(column){
var x = 0;
var b = 1;
while(b != 2){
x++;
var data = isempty(x, column);
if(data == true){
b = 2;
}
}
alert(x);
return x;
}
When there is 5 non empty cells in a column, the first of these being first cell in the column, I expect the return value to be 6, but the function returns 3 regardless of the actual states(not-empty, empty) of cells in a column.
Any help would be greatly appreciated.