i've been coding this on the google apps script for a sheet:
function basePesa(){
var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("aux");
var unique = sheet.getRange("C1").setFormula("=unique(A:A)");
var Avals = sheet.getRange("C1:C").getValues();
var Alast = Avals.filter(String).length;
var transp = sheet.getDataRange().getValues();
var ss = SpreadsheetApp.openById("14Y3xiAa9kdoK_YO_tAVN-YWC9RE1EANV5wm8Ez1sa1o");
var base =ss.getSheetByName("Base PESA");
var values = base.getDataRange().getValues();
var newdata = new Array(values.length);
var y = 0;
// Browser.msgBox(transp.length);
for(var i=0;i<Alast;i++){
var tra = Avals[i][0];
for(var x =1; x<values.length;x++){
if(values[x][18] == tra){
newdata[y] = new Array(values[0].length);
for(var p=0; p<values[0].length;p++)
newdata[y][p] = values[x][p];
y++;
}
}
}
SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Bco de Dados").getRange("A2:AZ"+(y+1)+"").setValues(newdata);
// Browser.msgBox(newdata);
}
It seems that I can't get to write the array into a range. I've checked if the ranges match as well as i'm certain that this array is a 2D one. Any instructions?
Thanks in advance!