Using the gsheets library, I can calculate the total number of rows in a specific sheet:
var sheet = ss.worksheetByTitle('test');
var rows = await sheet?.values.map.allRows();
var totalRows = rows?.length;
However, the above code requires fetching the row data from the sheet. Is it possible to get the total number of rows without fetching the actual data?
2
Answers
you can use
Worksheet().rowCount;
I found it in this file Gsheets
You can easily do this by allRow method
here is an example:
//get worksheetbytitle first!
var allRows = await _workSheet?.values.map.allRows();
var totalRows = allRows?.length;
// print row data
for (var i = 0; i < allRows!.length; i++) {
print(allRows[i]);
}