A
A
Alexey Kukharichev2018-11-20 11:42:46
Google Sheets
Alexey Kukharichev, 2018-11-20 11:42:46

How to count the number of cells in a google spreadsheet?

Good afternoon, there is a table in which there are just a lot of sheets + a lot of values ​​​​on each of the sheets. I would like to know how to count the number of filled cells in all sheets. In Google help, the closest COUNT command, but there you need to specify the range on one sheet, this is not fast at all, maybe there is something better?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey Kukharichev, 2018-11-29
@Kuhnya

Solved by installing the size my sheet add-on.

T
tartakx2, 2022-02-10
@tartakx2

function getSSsize(){
  var sheets = SpreadsheetApp.getActiveSpreadsheet().getSheets();
  var total = 0;
  for (var i=0 ; i<sheets.length ; i++){
    var dataValues = sheets[i].getDataRange().getValues();
    var item = dataValues[0].length*dataValues.length;
    Logger.log('%s: %s', sheets[i].getName(), item);
    total += item; 
  }
  Logger.log('Total:  %s', total);
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question