I need a script to find the first empty row of a google spreadsheet drive , or that since open this spreadsheet in the first empty row.
So, I tried this:
function onOpen(){
var menu = SpreadsheetApp.getUi();
menu.createMenu('Audit PS')
.addItem('Colar', 'getFirstEmptyRowByColumnArray')
.addToUi();
}
function getFirstEmptyRowByColumnArray() {
var spr = SpreadsheetApp.getActiveSpreadsheet();
var column = spr.getRange('A:A');
var values = column.getValues();
var ct = 0;
while ( values[ct] && values[ct][0] != "" ) {
ct++;
}
return (ct+1);
}
The menu was created and by clicking on it , the script runs . But nothing happens in the spreadsheet.
what is wrong?