Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Expandable Importrange

I am combining several spreadsheets with identical layouts into one master, and want to create a way to have my query({importrange}) be dynamic, as I will be adding / removing some sheets as time goes on. I have all of my sheet addresses in column C, so my formula right now looks like:
=QUERY({Importrange(C4,Sheet1!C5:F);Importrange(C5,Sheet1!C5:F);…}
This works fine, but any time I add/remove a sheet I would have to edit a very long string.
Is there a way for QUERY or IMPORTRANGE to reference another cell that combines my various spreadsheets listed in column C?
I’ve tried variations of CONCATENATE, JOIN, etc to combine C into one cell that is referenced in the QUERY OR IMPORTRANGE, but no luck so far.

Trying to future-proof a little…

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

no, but you can do this:

={""; ARRAYFORMULA("=QUERY({"&TEXTJOIN("; ", 1, 
 IF(C4:C="",,"IMPORTRANGE("""&C4:C&""", ""Sheet1!C5:F"")"))&
 "}, ""where Col1 is not null"", )")}

enter image description here

so it will automatically create a formula for you and then you just copy-paste it where you need it

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading