I have two arrays that I am trying to combine in GAS, arr2 is multidimensional.
arr1 = ["Diesel", "Solar", "Biomass"]
arr2 = [
["ABC", "Nigeria", "Diesel,Solar", 35],
["DEF", "Egypt", "Solar,Diesel", 50],
["GHI", "Ghana", "Biomass,Diesel", 70]
]
What I want to do is push the elements of arr1 into arr2 at index 3 in each row, so it looks like:
newArr = [
["ABC", "Nigeria", "Diesel,Solar", "Diesel", 35],
["DEF", "Egypt", "Solar,Diesel", "Solar", 50],
["GHI", "Ghana", "Biomass,Diesel", "Biomass", 70]
]
I have tried to use .map over arr2 to .Splice each row but couldn't get it to work. Any help would be much appreciated!