So I have two arrays like this.
let emailList = [ [ 'OM Email', 'Team/Location' ],
[ '[email protected]', 'Addison' ],
[ '[email protected]', 'SouthArlington' ]]
let data = [ [ 'Addison',13373,'Addison','Office Team',4,'Jordan M','DFW','General',2,1,0,31,63,
73 ],
[ 'SouthArlington',13373,'SouthArlington','Office Team',4,'Jordan M','DFW','General',2,1,0,31,63,
73 ],
[ 'Addison',13374,'Addison','Office Team3',5,'Jordan M','DFW','General',2,1,0,31,63, 73 ] ]
id like to filter through the data array and see if it finds a location from the emailList. (The position from the data is at 2 ) if it does find a location from the data, pop it and create a new array each time for each location.
What I am trying to do is I am filtering through a google-sheets for when a certain column equals something. That is currently working, thats the information from the data array. What I am trying to do is send a notification to each office from the emailList along with their respectives rows.
this is how iam filtering data from the google-sheet doc
let data = thisSpreadsheet.filter(function (row,index) {
return row[11] >= 30
});
if i filter again on data, i get the results but i need it for each matching office.
let locationList = data.filter(function(location){
return location[2] === emailList[1][1]
})
Expected:
let Addison = [[ 'Addison',13373,'Addison','Office Team',4,'Jordan M','DFW','General',2,1,0,31,63,
73 ],
[ 'Addison',13374,'Addison','Office Team3',5,'Jordan M','DFW','General',2,1,0,31,63,
73 ]]
let SouthArlington = [ 'SouthArlington',13373,'SouthArlington','Office Team',4,'Jordan M','DFW','General',2,1,0,31,63,
73 ]