user15635022
user15635022

Reputation: 37

How to specify the range of all rows containing data in Google Sheets

What is the syntax for selecting the full range of rows which contain data?

Say for instance I have 200 rows of data. Im running some functions which loop through rows. If I wanted to select the range of these rows manually from column A, I would write is as A1:A200.
But is there a way to write it from "A1" : "last row in the column A that contains an entry"

Alternatively is there a way to write A1:"end of column A, regardless of entries"?

thanks

Upvotes: 0

Views: 1266

Answers (2)

Wellerman
Wellerman

Reputation: 856

You can write A1:A to get the entire column, or A1:Z to get a range of columns. In Apps Script, you can call sheet.getLastRow() (or sheet.getLastColumn()) to get the last row containing data and use that to write your loops.

References

Upvotes: 1

JPV
JPV

Reputation: 27242

You can also consider the use of getDataRange().This method returns a Range corresponding to the dimensions in which data is present.

Upvotes: 0

Related Questions