I have hundreds of reports in my google drive. Each report is its own file (Spreadsheet, with one sheet).
I need a total of cell B10 from all those spreadsheets. It would be great if there was a function that took two parameters:
- the name of the directory containing the Spreadsheet files
- the specific cell you want totaled.
I tried to do script
function Suma(cell)
{
var files = DocsList.getFilesByType('spreadsheet', 0, 100);
for (var i = 0; i < files.length; i++)
{
var sheets = SpreadsheetApp.open(files[i]).getSheets();
var sum = 0;
for (var i = 0; i < sheets.length ; i++ )
{
var sheet = sheets[i];
var val = sheet.getRange(cell).getValue();
if (typeof(val) == 'number')
{
sum += val;
}
}
}
return sum;
}
need some help of course :) THX