title: Looking up values and adding them to a table in a dynamic sheet
body: <p>I have two Google sheets (tabs) for an inventory database, which is automatically updated every two hours by a script:</p>
  
  <ol>
  <li><p>Sheet "A" containing all the products in our warehouse: 
  Product_ID, Product_Name, Colour, Size, Price</p></li>
  <li><p>Sheet "B" containing the activity/transactions:
  Product_ID, Transaction_ID, Quantity</p></li>
  </ol>
  
  <p>I would then like to build a new sheet "C" based on a formula, with the following columns:
  Product_ID, Transaction_ID, Quantity, Product_Name, Colour, Size, Price</p>
  
  <p>Basically joining the two on "Product_ID".</p>
  
  <p>The reason I cannot just do this manually is that Sheet A and B are automatically regenerated every 2 hours based on changes in the database.</p>
  
  <p>The purpose of all of this is to enable flexible querying and calculations on the stock using the power of the spreadsheet  :)</p>
  
  <p>I tried joining using Google Query Language but seems there isn't syntax in there for joining separate tables.</p>