Concat in a for loop google app scripts javascript

I’m trying to filter in an array by data in another array using concat in a for loop. The elements of the following code are logging correctly, but the final array is logging an empty array.

function Shipments (){
  var app = SpreadsheetApp;
  var movementSS = app.getActiveSpreadsheet();
  var infoSheet = movementSS.getSheetByName("Update Info");
  var orderInfoSheet = movementSS.getSheetByName("Order Info");

  var targetSheet = movementSS.getSheetByName("Shipments");
  var ShipLogSS = app.openByUrl(URL).getSheetByName("Shipping Details");

  var ShipArr = ShipLogSS.getRange(3,1,ShipLogSS.getLastRow(),ShipLogSS.getLastColumn()).getValues().
    filter(function(item){if(item[1]!=""){return true}}).
    map(function(r){return [r[0],r[1],r[2],r[4],r[10],r[11],r[16],r[18],r[23]]});

  var supplierData = orderInfoSheet.getRange(3,6,orderInfoSheet.getLastRow(),1).getValues().
    filter(function(item){if(item[0]!=""){return true}});

  var supplierList = [];
  for (var i in supplierData) {
    var row = supplierData[i];
    var duplicate = false;
    for (var j in supplierList) {
      if (row.join() == supplierList[j].join()) {
        duplicate = true;
    if (!duplicate) {

  var supplierFilter = [];
  for(var i = 0; i < supplierList.length; i++){
    var shipments = ShipArr.filter(function(item){if(item[4]===supplierList[i][0]){return true}});



Any help would be greatly appreciated!

23 thoughts on “Concat in a for loop google app scripts javascript”

Leave a Comment