I have a google sheet with a dynamically changing number of worksheets within it. I'd like to be able to automatically union all worksheets that included in a named range that has the worksheet names.
I have a manual formula that is working and will union all data into a single worksheet. I'd like to make this computed from the named range.
UNION FORMULA
={QUERY('Sheet1'!A2:L, "select * where A != ''");QUERY('Sheet2'!A2:L, "select * where A != ''")}
I also have a named range in another sheet which has all the worksheet names
NAMED RANGE
WORKSHEET_NAMES = {Sheet1,Sheet2,Sheet3)
I also have previously used this to pull data from the worksheets using
Col A - this duplicates the range of worksheet names in column A
=QUERY(WORKSHEET_NAMES, "select A where A != ''")
Col B-Z - this looks up the worksheet name and pulls in the range from a string
=QUERY(indirect($A2&"!$A$2:$N"), "select * order by B desc limit 1")
I don't know if it's possible to (I've been searching for 1+ hours now) to combine my worksheet name lookup with my union operation, or if I'll need to resort to writing something in google scripts to allow me to do the union.
EDIT
The "Union" sheet shows the desired output, but is a manual formula and not generated from the named range WORKSHEET_NAMES
The "Latest" sheet show the named range WORKSHEET_NAMES being used using an INDIRECT to pick a range from a string.