javascript - Issue with getLastRow() -
i have issue getlastrow(). thought function supposed return last row has data. since worksheet working on has lot more vacant rows below rows filled data, functions seems go in , select last vacant row on execution instead of selecting last row has data, may not same. can 1 tell me how fix anomaly. google script bug or not understanding do? please ask further questions if didn't make myself clear.
do have "whole-column" formulae in sheet? either array formulae, or formulae copied way down? if these formulae designed return blank cells down bottom, getlastrow() still catch them.
if case, try:
function getlastpopulatedrow(sheet) { var data = sheet.getdatarange().getvalues(); (var = data.length-1; > 0; i--) { (var j = 0; j < data[0].length; j++) { if (data[i][j]) return i+1; } } return 0; // or 1 depending on needs }
Comments
Post a Comment