i need script find first empty row of google spreadsheet drive , or since open spreadsheet in first empty row.
so, 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 created , clicking on , script runs . nothing happens in spreadsheet.
what wrong?
it bit unclear trying accomplish, try best based on think youre going for.
sounds want select last row in spreadsheet 1 column. not sure if mean getting cells object or setting active.
first off, selecting spreadsheet, not sheet, recommend changing getactivespreadsheet() getactivesheet(). lets assume code looks this:
var sheet = spreadsheetapp.getactivesheet();
range of cells in sheet contain data, use .getdatarange() function on sheet. can use .getlastrow() function last row containing data. once know this, have info need. if trying cell object, code this"
var sheet = spreadsheetapp.getactivesheet();
var lastrow = sheet.getdatarange().getlastrow(); var cell = sheet.getrange(lastrow + 1, 1); // substituted whatever column second argument
haven't specified want once cell, have figure rest out yourself! hope helps.
Comments
Post a Comment