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!
Array 1: [ A , B , C ] <---- Compatible for 1 Row, 3 Columns
Array 2: [ [A] , [B] , [C] ] <--- Compatible for 3 Rows, 1 Column
Array 3: [ [ A , B , C ] , [ A , B , C ] , [ A , B , C ] ] <--- Compatible for 3 Rows , 3 Columns**
**Important to note that the width of each smaller array within the larger array (in this case 3), must be the same for each of the smaller arrays.
Click Here for a Visual Example (Image)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With