function addData(type){
/*
Somehow I get 2d array: result
*/
var arr = [];
var c = [];
var i, j;
for (i = 0;i < result.length-1; i++) {
c=[];
for (j = 0; j < result[0].length; j++){
c.push(result[i][j]);
}
arr.push(c);
}
var sheet = SpreadsheetApp.getActiveSheet();
sheet.getRange(1, 1, i+1, j+1).setValues(arr);
}