This question already has an answer here:
- Determining the last row in a single column 16 answers
I have looked at solutions for this but all the ones I have found seem to be way more advanced than I need. All I am looking for is a way to know how many cells in column A are populated. I don't want to use a formula within the sheet, I want to be able to calculate the answer 'on-the-fly' in my script.
Is that possible?
Well, you can try something like this this
Incase someone needs formula :
=COUNTIF(<start_cell>:<end_cell>; "<>")
For example :
=COUNTIF(A1:A10; "<>")
For full reference and Credits :
google docs count cells that contain any text
count empty values in array
If you want something short you can take advantage of
Array.filter()
:Edit 2 : Sorry, you actually want to know how many are populated, so :
Edit 3 : Snippet