title: Google Sheet Query - Building Reference Array Dynamically
body: <p>I have multiple tabs in a file and want to merge the same range to a master tab.</p>
  <p>I did a Query</p>
  <pre><code>=QUERY({source1!AR5:AU;source1!AR5:AU}, &quot;select Col1,Col2,Col3,Col4 where Col1 is not null order by Col1&quot;, 0)
  </code></pre>
  <p>But at the end I will have more and more tabs (around 30), and I don't want to change my query manually each time. how can i do?</p>
  <p>I saw somewhere that I can use macros to create a function, do you have an idea of the code?
  I just want to have something easy where I have added in another tab all my tab names</p>