Query Sheets with a temporary table
Stay organized with collections
Save and categorize content based on your preferences.
Query data from a Google Sheets file by creating a temporary table.
Explore further
For detailed documentation that includes this code sample, see the following:
Code sample
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],[],[[["\u003cp\u003eThis content demonstrates how to query data from a Google Sheets file by creating a temporary external table within BigQuery, using both Java and Python.\u003c/p\u003e\n"],["\u003cp\u003eThe code samples require setting up Application Default Credentials for authentication and include enabling both the BigQuery and Google Drive APIs.\u003c/p\u003e\n"],["\u003cp\u003eThe temporary table is defined using an external configuration pointing to a Google Sheets URL, along with a defined schema and optional parameters such as skipping header rows and specifying a range.\u003c/p\u003e\n"],["\u003cp\u003eExample queries, such as selecting data where the name starts with 'W', are executed against this temporary table, showcasing the process of filtering data from the sheet.\u003c/p\u003e\n"],["\u003cp\u003eThe code provided in both Python and Java has been tested to show how to query the external Google Sheets file data, as well as how to set up the code so the query is successful.\u003c/p\u003e\n"]]],[],null,[]]