I would like to "inner join" 2 data-ranges (SHEET 1 & 2) by "ID" and output its result in SHEET 3 (as shown below)
For all sheets the first row is only the header, the actual values start from the second row.
Sheet 1 is the entire Database (3000 rows), and Sheet 2 (1000 rows) is a selection of Sheet 1 with additional data. Each entry (ID) is only present once in each Sheet.
Sheet 3 should show comprise only the rows of Sheet 2 but with the data of the corresponding row (by ID) of Sheet 1.
var sheetOneVals = sheetOne.getDataRange().getValues();
sheetOneVals.splice(0, 1);
var sheetTwoVals = sheetTwo.getDataRange().getValues();
sheetTwoVals.splice(0, 1);
How can this be done? https://stackoverflow.com/a/17500836/379777 was almost what I wanted except that it uses Keys, which I don't have in my case.
SHEET 1:
A B C D
------------------------------------
1 | Name | Description | Price | ID |
------------------------------------
2 | ABC | Bla1 | 10 | 123 |
------------------------------------
3 | DEF | Bla2 | 8 | 234 |
------------------------------------
: | : | : | : | : |
: | : | : | : | : |
------------------------------------
SHEET 2:
A B C D E
---------------------------------------
1 | ID | Cat1 | Cat2 | Cat3 | Nonsense |
---------------------------------------
2 | 123 | B | C | D | xyz |
---------------------------------------
: | : | : | : | : | : |
: | : | : | : | : | : |
---------------------------------------
SHEET 3 (desired result):
A B C D E F G
----------------------------------------------------------
1 | ID | Cat1 | Cat2 | Cat3 | Name | Description | Price |
----------------------------------------------------------
2 | 123 | B | C | D | ABC | Bla1 | 10 |
----------------------------------------------------------
: | : | : | : | : | : | : | : |
: | : | : | : | : | : | : | : |
----------------------------------------------------------