I'm working to create an Apps Script to automate some of my tasks at work. I am able to get the desired results with the g-sheet equation: =ARRAYFORMULA(VLOOKUP(A2:A2000,UNIQUE(QUERY({A2:A2000,F2:F2000,I2:I2000},"SELECT Col1, Col2, Col3 WHERE Col3 = 'Employee'", 0)),2,FALSE))
which works in 3 parts:
- Query: returns only the unique "Employee" values for columns A, F, & I.
- V-Lookup: Returns the 2nd index of the query based on matching e-mails.
- Array Formula: Returns all values for the entire array in column A.
However, I need to convert the functions above to an Apps Script acceptable format, and where the result of the script would be to return an array containing the values. I have been searching around to find something similar, but have not had much luck with it.