Assume there are 2 tabs/sheets (Sheet 1 and Sheet 2) in the workbook and the requirement is to query all or specific set of columns from Sheet 2. Select a cell in Sheet 1 and add the following command.
Formula
=query('Sheet 2 - Test Sheet'!A1:E10, "SELECT B, C, D, E WHERE A Matches '" & D34 & "' ", 0)
Details
1. Sheet 2 - Test Sheet is the second tab/sheet. 2. A1:E10 represents selection of the dataset on which we want to run the query. 3. We are selecting columns B, C, D and E from Sheet 2. 4. We are adding a condition where the cell value in D34 of the Sheet 1 matches the column A in Sheet 2. 5. The value 0 is to ignore copying the header from Sheet 2 to Sheet 1.