I'm using the following code to get all the value of all my sheets that have a numeric name. Once it find a numeric sheet name, it must sum row 8 to 108 of column 6. All the sheets must be sum in the right array. Right now, my script add the data in the array after then it crash instead of doing a sum.
example (cell = value : variable = value)
- sheet 1 (8,6)=1 : colonne[1] = 1
- sheet 2 (8,6)=2 : colonne[1] = 3
- sheet 3 (8,6)=3 : colonne[1] = 6
- sheet 1 (8,7)=2 : colonne[2] = 2
- sheet 2 (8,7)=2 : colonne[2] = 4
- sheet 3 (8,7)=2 : colonne[2] = 6
function CalculTotal() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var s = ss.getActiveSheet();
var out = new Array()
var sheets = SpreadsheetApp.getActiveSpreadsheet().getSheets();
var substring1;
var colonne=[];
for (var i=0 ; i<sheets.length ; i++)
{
substring1=sheets[i].getName();
if(!isNaN(parseFloat(substring1)) && isFinite(substring1)){
colonne=colonne+(ss.getSheetByName(substring1).getRange(8,6,100).getValues());
}
}
s.getRange(8,4,100).setValues(colonne);
}