Combining multiple spreadsheets in one using IMPORTRANGE

后端 未结 4 684
眼角桃花
眼角桃花 2021-02-06 01:03

I would like to aggregate the data of multiple spreadsheets into one spreadsheet.

  • Spreadsheet 1 has a Row of Strings A2:A500
  • Spreadsheet 2 has a Row of St
相关标签:
4条回答
  • 2021-02-06 01:43

    Of course, it is also possible to combine several IMPORTRANGE() functions with the QUERY() function, which gives us a greater control over the results we import.

    For example, we can use such a construction:

    =QUERY(
      {
        IMPORTRANGE("key-or-url-of-spreadsheet-1", "'sheet-name-1'!A2:Z100");
        IMPORTRANGE("key-or-url-of-spreadsheet-2", "'sheet-name-2'!A2:Z100");
        IMPORTRANGE("key-or-url-of-spreadsheet-3", "'sheet-name-3'!A2:Z100");
        IMPORTRANGE("key-or-url-of-spreadsheet-4", "'sheet-name-4'!A2:Z100")
      },
      "SELECT * WHERE Col1 IS NOT NULL ORDER BY Col3 ASC"
    )
    

    Explanation:

    The above query removes blank lines from imported ranges:

    SELECT * WHERE Col1 IS NOT NULL
    

    and sorts ascending all data collected together in relation to the third column:

    ORDER BY Col3 ASC
    

    For descending, just use DESC in place of ASC.

    Of course, we can also arrange any other criteria, or omit them displaying everything without modification:

    "SELECT * "
    

    Note:

    In order to use the above constructed query, we first need to call a single IMPORTIMAGE() method for each of the spreadsheets we want to refer:

    =IMPORTRANGE("key-or-url-of-spreadsheet-1", "'sheet-name-1'!A2:Z100")
    

    We have to do this even if we refer to the same spreadsheet in which we write this formula, but for every spreadsheet it is enough to do it once.

    This is to be able to connect these sheets and allow access to the sheets (to which we have the access rights anyway):

                                                        

    After giving permission for all spreadsheets, we can use the above query.

    0 讨论(0)
  • 2021-02-06 01:51

    You should be able to use a vertical array in the Spreadsheet 3:

    ={IMPORTRANGE("Sheet1Key","SheetName!A2:A500");IMPORTRANGE("Sheet2Key","SheetName!A2:A500")}
    
    0 讨论(0)
  • 2021-02-06 01:56

    I am also applying above given formula for getting data from multiple spreadsheet which is getting an error something is like IN ARRAY_LITERAL An array literal was missing values for one or more rows.

    0 讨论(0)
  • 2021-02-06 01:56

    Easy fix: Apply the filter to the entire column / sheet instead of just the current selection. This will automatically update all of the filters to include new additions.

    0 讨论(0)
提交回复
热议问题