How can I query data from another sheet in Google Sheets?

To query data from another sheet in Google Sheets, you can use the “IMPORTRANGE” function. This function allows you to import data from a specific range of cells in a different sheet within the same spreadsheet or in a different spreadsheet altogether. To use this function, you will need to specify the URL of the spreadsheet, the sheet name, and the cell range you want to import. This will allow you to access and manipulate data from multiple sheets in one place, making it easier to analyze and organize your data. Additionally, you can also use the “QUERY” function to filter and sort data from another sheet based on specific criteria. By using these functions, you can efficiently retrieve and work with data from different sheets in Google Sheets.

Google Sheets: Query From Another Sheet


To query from another tab within the same spreadsheet in Google Sheets, you can use the following syntax:

=query(stats!A1:C9, “select A, B“, 1)

This returns columns A and B from the cell range A1:C9 within the tab named stats. The 1 specifies that there is 1 header row at the top of the dataset being queried.

To query from another spreadsheet entirely, you can use the following syntax:

=query(importrange(“URL“,  “stats!A1:C9“), “select Col1, Col2“, 1)

This returns the first two columns from the cell range A1:C9 within the tab named stats within the Google Sheets spreadsheet with a specific URL.

The following examples show how to use these functions in practice.

Example: Query from Tab in Same Spreadsheet

Suppose we have the following Google Sheets spreadsheet with two tabs: 

  • stats
  • new_sheet

To perform a query on the data in the stats tab and return the results of the query in the new_sheet tab, we can type the following formula in cell A1 of the new_sheet tab:

Example: Query from Another Spreadsheet

Now suppose that we would like to query from another spreadsheet entirely. To do so, we simply need to identify the URL of the Google Sheets spreadsheet that we’d like to query from.

For example, suppose the data we’re interested in is located at the following URL:

Notice the subtle difference between this example and the previous example:

  • When querying from a tab within the same spreadsheet, we use select A, B
  • When querying from an entirely different spreadsheet, we use select Col1, Col2

You can find more Google Sheets tutorials on .

x