var Avals = ss.getRange("A1:A").getValues(); var Alast = Avals.filter(String).length;
I borrowed this idea from this answer. The
Array.filter() method is operating on the
Avals array, which contains all the cells in column A. By filtering on a native function's constructor, we get back only non-null elements.
This works for a single column only; if the range contains multiple columns,then the outcome of
filter() will include cells from all columns, and thus be outside the populated dimensions of the range.
~ Answered on 2013-07-14 06:39:37