Answer the question
In order to leave comments, you need to log in
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
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 questionAsk a Question
731 491 924 answers to any question