BACKGROUND. I want to change a timesheet from a week format (every row shows 7 days, no date is available only week in the from yyww (e.g. 1225). In another sheet one column
setValues()
and getValues()
always use 2 dimension arrays, even if the range is only 1 row high, so you should use:
LINE 212 sheet_IndataTabell.getRange(1, 1, 1, 2).setValues([IndataTable_Temp])
(pay attention to the pair of brackets I added.)
Also, even if it's not an issue, you don't need to define the size of the array before using Range.getValues()
, just drop the (NumberRows_Cal,NumberCols_Cal)
you put as parameters,
var CalendarArray = new Array()
is sufficient.
EDIT : about your comment : please add these two Logger.log in your code at line 225, when you get your 2 arrays, one of which not useable in setValues() and you'll see what happend :
Logger.log(IndataTable);//this one contains JS objects between {}
Logger.log(IndataTable_Temp);// this one contains array elements between [[]]
//Writes the array content to the sheet
sheet_IndataTabell.getRange(1, 1, i, 11).setValues(IndataTable_Temp);
EDIT2 : I made a small change to the end of your script, now data are pure strings and array is real 2D (watch the brackets again):
//Reconstruction the Array, I do not know why this is needed
var IndataTable_Temp = new Array();
for (i=0; i<IndataTable.length; i++) {
// Logger.log(typeof(IndataTable[i][0]))
IndataTable_Temp.push([
IndataTable[i][0],
IndataTable[i][1],
IndataTable[i][2],
IndataTable[i][3],
IndataTable[i][4],
IndataTable[i][5],
IndataTable[i][6],
IndataTable[i][7],
IndataTable[i][8],
IndataTable[i][9],
IndataTable[i][10]
]);
}
Logger.log(IndataTable)
Logger.log(IndataTable_Temp)
//Writes the array content to the sheet
sheet_IndataTabell.getRange(1, 1, IndataTable_Temp.length, IndataTable_Temp[0].length).setValues(IndataTable_Temp);
//Sets timestamp
sheet_IndataTabell.getRange("L1").setValue(Date());