I have read this two links Google Script: Conditionally copy rows from one spreadsheet to another and https://stackoverflow.com/a/4809413/1526044 and after trying i am not able to do what i need.
I have one spreadsheet with some data on one sheet. Also i have another sheet with key information on columns to compare this way:
KEY Value1 Value2 Value3
AAA B C D
BBB Y Z W
I need a function that check the my DATA spreadsheet row by row looking for the values on the columns values on the key sheet. And when any of the values is found it writes down on the first column of the DATA spreadsheet (on the same row) the KEY value.
Example: DATA spreadsheet
empty text text text B
empty text text text text
empty text C text text
empty text text text Y
So after the script, DATA will look like this:
AAA text text text B
empty text text text text
AAA text C text text
BBB text text text Y
Any other suggestion to make this will be appreciated. Thank you very much.
I modified a similar script I answered recently that should do what you need. I didn't test but you can give it a try. There are some comments to explain the idea... it probably needs some debugging.
EDIT : I played around with this and debugged it a bit more ;-) so it seems to work as needed now - here is the link to my test sheet