Search code examples
google-sheetsgoogle-sheets-formulaspreadsheet

Importing data from multiple sheets dynamically and sort by date


https://docs.google.com/spreadsheets/d/1G9-lVE15VlOUhMM_OVOn-Xwi7fmJHz-FNJdVVnwBCYI/edit#gid=2100307022

I need to import a range of data from another spreadsheet which has many sheets, I have a cell which contain the references to the spreadsheet and a column that list the all the sheet where I need to retrieve the data from. I am able to retrieve the data from a single sheets or type the sheets into the formula manually, but I need it to be done dynamically.

Using

ARRAYFORMULA( IF(F2:F<>"", IMPORTRANGE(G2, F2:F&"!A3:Q"), "") )

I was able to do what I need but the data spread across multiple row which causes an overlapping error.


Solution

  • You may try this base formula which you can wrap inside your existing query part:

    =reduce(tocol(,1),tocol(F2:F,1),lambda(a,c,vstack(a,importrange(G2,c&"!A3:Q"))))
    
    • make sure importrange is properly linked by granting permission to access source sheet

    enter image description here