1

I have an array picked from a google spreadsheets.

Now I have a single object from a different array arr[0][0] which is equal to an element present in the main array data.

Here is my code:-

function userClickedComp(arr)
{
  var today = new Date();
  var year = today.getFullYear();
  var ss2 = SpreadsheetApp.openById('1KtCHHj7CwXe6EOyMp_CgLAy2xFhOX2QrzyWetELhPMc');
  var name = "L.Balance."+year;
  var sheet1 = ss2.getSheetByName(name);
  var lastrow = sheet1.getLastRow();
  var data = sheet1.getRange("A1:A"+lastrow).getValues();
  
  var pos = data.indexOf(arr[0][0]);
  console.log(data+"......."+arr[0][0]+"........"+pos)
}

Here is my console. enter image description here

As you can see its giving me -1 but the matching value exists in the array.

Mask
  • 573
  • 7
  • 24

0 Answers0