AI-generated Key Takeaways
-
Access custom Google Analytics reports in BigQuery using the Google Analytics Sheets add-on and the Google Drive BigQuery connector.
-
Generate a custom report in Google Sheets, expose it as a BigQuery external table, and then query the data from BigQuery.
-
This method can be applied to any report type, using the User acquisition report as an example.
This guide explains how you can access custom Google Analytics reports from BigQuery using the Google Analytics Sheets add-on and Google Drive BigQuery connector .
This guide shows how to generate a custom report using the Google Analytics Sheets add-on, expose the report results sheet as a BigQuery external table, and then query the report data from BigQuery.
This guide uses the User acquisition report as an example, but you can apply these steps to any report type.
Step 1: Configure a custom report in Google Sheets
-
Install the Google Analytics Sheets add-on from the Google Workspace Marketplace .
-
Open the Extensions→ GA4 Reports Builder for Google Analytics→ Create new reportdialog.

-
Configure the report by specifying the Analytics property, date range and report fields.
-
Use the following fields for the User acquisition report:
Dimensions
-
firstUserDefaultChannelGroup
Metrics
-
eventCount -
keyEvents -
totalRevenue -
newUsers -
engagedSessions -
engagementRate
-
-
Leave the Dimensions filtersand Metrics filtersfields empty.
Here's an image of the correct report settings:



-
Click Create Reportto create the report configuration in the current Sheets document:

-
Select Extensions→ GA4 Reports Builder for Google Analytics→ Run reportsto generate the report. A new tab with your report name will be created once the report is complete.

-
Open the Extensions→ GA4 Reports Builder for Google Analytics→ Schedule reportsdialog to set up periodic polling of the latest report data. Specify the schedule and click Save.

Step 2: Connect a Google Sheet report document as a BigQuery external table
With BigQuery, you can create a permanent table linked to your external data source in Google Sheets. Use this feature to connect the Google Analytics report spreadsheet created in the previous step as a BigQuery external table.
This step requires following the Create Google Drive external tables guide from the BigQuery documentation.
Google Cloud console
-
In the Google Cloud console, open the BigQuery page.
-
In the Explorerpanel, expand your project and select a dataset.
-
Expand the Actionsoption and click Open.
-
In the details panel, click Create table .
-
On the Create tablepage, in the Sourcesection:
-
For Create table from, select Drive.
-
In the Select Drive URIfield, enter the Drive URI of the Google Sheet document containing the report, in the form
https://docs.google.com/spreadsheets/d/[file_id]. -
For File format, select Google Sheet
-
-
On the Create tablepage, in the Destinationsection:
-
For Dataset name, choose the appropriate dataset, and in the Table namefield, enter the name of the table you're creating in BigQuery.
-
Verify that Table typeis set to External table.
-
-
In the Sheet rangebox, specify the sheet name and cell range to query. This should be the Sheet containing your report data:
sheet_name!top_left_cell_id:bottom_right_cell_idfor a cell range. For our example report, the range can be specified asUser acquisition report!A:G. Note how the sheet corresponding to the custom report name is mentioned in the range. -
In the Schemasection, enable Auto detect.
-
Expand the Advanced optionssection, in the Header rows to skipbox specify the number of rows to omit. In our example, the report data starts with row 15 , which is the value that should be set in the input box.
-
On the Create tablepage, in the Destinationsection:
-
For Dataset, choose the appropriate dataset, and in the Tablefield, enter the name of the table you're creating in BigQuery.
-
Verify that Table typeis set to External table.
-
-
Click CREATE TABLE.
-
If necessary, select your account and then click Allowto give the BigQuery client tools access to Drive.
Here is an example of an external BigQuery table configuration screen:


Step 3: Query a Google Sheets report table from BigQuery
You can now run a query against the Google Sheets report table as if it were a standard BigQuery table, subject to the limitations on external data sources.
-
Open the
user_acquisition_reporttable to inspect its schema:
-
Click Query. In the suggested query, change
SELECT FROMtoSELECT * FROMto obtain all report fields, and then Run queryto run a query against the external table.
The query in the following example will output a snippet of data in the table for all columns:


