skip to Main Content

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


  1. you can use Worksheet().rowCount;

    I found it in this file Gsheets
    here

    Login or Signup to reply.
  2. 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]);
    }

    1. List item
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search