Follow me on LinkedIn - AI, GA4, BigQuery

Follow the steps below to connect and transfer data from Google Sheets to BigQuery:

Step-1: Navigate to your BigQuery account: https://console.cloud.google.com/bigquery

Step-2: Click on the drop-down menu at the top:

Click on the drop down menu at the top

Step-3: Click on the ‘New Project’ button:

New Project bigquery

Step-4: Name the project ‘Google Sheets’, rename the project id (by clicking on the ‘edit’ button) to something easily recognizable and then click on the ‘create’ button:

New Project bigquery 2

Step-5: Click on the ‘SELECT PROJECT’ link on the top right-hand side of your screen:

SELECT PROJECT

Step-6: Click on your project ID:

Click on your project ID

Step-7: Click on the ‘CREATE DATASET’ button on the top right-hand side of your screen:

CREATE DATASET

Step-8: Name your data set (say ‘Google_Sheets_Dataset’) and then click on the ‘Create dataset’ button:

Name your data set

Step-9: Click on the name of your new dataset:

Click on the name of your new dataset

Step-10: Click on the create table button:

Click on the create table button

We are going to use this table for storing data from Google Sheets.

Step-11: Click on the ‘Create table from’ drop-down menu:

Click on the Create table from drop down menu

Step-12: Click on the ‘Drive’ option:

Click on the Drive option

You should now see a screen like the one below:

You should now see a screen like the one below

Step-13: Navigate to the Google Sheets whose data you want to send to BigQuery and then copy the sheet URL:

Navigate to the Google Sheets whose data you want to send to BigQuery

Step-14: Paste the Google sheet URL in the text below ‘Select drive URL’:

Paste the Google sheet URL

Step-15: Set file format to ‘Google Sheet’:

Set file format to Google Sheet

Step-16: Enter the cell range to indicate which sheet and cell range in the Google Sheets to create a table from:

Enter the cell range
cell range

Note: If you entered an incorrect cell range then either you may get unexpected data when you query your table or your query may fail to execute. 

Step-17: Enter a table name (say ‘Traffic_Data_Table’):

Enter a table name

Now we need to define a schema for our new table. 

You won’t be able to query your data table without defining the schema first. 

The schema that you define should be based on the data type of the data in your Google Sheets:

data type of the data in your Google Sheets

Step-18: Click on the ‘+Add field’ button:

Add field

Step-19: Enter the name of your field, set the data type and then click on the ‘+Add field’ button to add another field:

Enter the name of your field

Step-20: Repeat step-19 as many times as required and then click on the ‘Create table’ button:

data table schema bigquery

Step-21: Click on the name of your new data table:

Click on the name of your new data table

Step-22: Click on the ‘QUERY TABLE’ button:

QUERY TABLE

Step-23: Enter your SQL statement(s) and then click on the ‘Run’ button:

Enter your SQL statement

If you set up your table schema correctly then your query would run and you should be able to see query results from your Google sheets document:

see query results from your Google sheets document 1

If your table schema is not set up correctly or the data in your Google Sheets is not formatted correctly or you used an incorrect cell range while creating the table then your query could fail and you would see an error message like the one below:

query failed bigquery

Note: If you did not set up your table correctly then you would need to delete your table and create a new table:

delete table bigquery

Step-24: Click on the ‘SAVE RESULTS’ button to save your query results:

save results

Step-25: Choose where to save the results data from the query from the drop-down menu

Choose where to save the results data from the query

Let’s select ‘BigQuery table’:

BigQuery table

Step-26: Enter the name of the data table where to want to store your query results and then click on the ‘Save’ button:

save query results bigquery

You should now see a new table listed under the data set ‘Google_Sheets_Dataset’:

result data table

Step-27: Click on the name of this data table:

Click on the name of this data table

Step-28: Click on the ‘Preview’ tab:

preview tab

You should now be able to see your previous query results permanently stored as a data table in BigQuery:

Google Sheets to BigQuery
  1. Google Analytics 4 Page Title, Page Path & Views in BigQuery
  2. Google Analytics 4 Unique Pageviews in BigQuery.
  3. Google Analytics 4 Traffic Attribution in BigQuery.
  4. Finding Real Google Analytics 4 Conversion Paths in BigQuery.
  5. Tracking Google Analytics 4 UTM Parameters in BigQuery.
  6. Tracking Google Analytics 4 AI Traffic in BigQuery.
  7. Tracking peak time for Website Traffic in GA4 BigQuery.
  8. How to Correctly Work With Google Analytics Data Types in BigQuery.
  9. Three SQL Query Logic You Must Use For GA4 in BigQuery.
  10. Four Rules for Google Analytics Data Aggregation in BigQuery.
  11. Top 10 Optimization Strategies for GA4 SQL in BigQuery.
  12. How To Correctly Track GA4 Sessions in BigQuery.
  13. Tracking Google Analytics 4 Engaged Sessions in BigQuery.
  14. Tracking Google Analytics 4 Total Users in BigQuery.
  15. Tracking Google Analytics 4 New Users in BigQuery.
  16. Tracking Google Analytics 4 Returning Users in BigQuery.
  17. What is BigQuery Data Transfer Service & how it works.
  18. How to send Custom GA4 Data to BigQuery.
  19. Connect and transfer data from Google Sheets to BigQuery.
  20. Query GA4 data in BigQuery without understanding SQL.