DocsOpen Henkan Chat
Connectors

BigQuery

Connect BigQuery with a service-account key. Roles, steps, example questions, read-only SQL with a cost cap, Usage and limits, who pays and troubleshooting.

Up to date with v1.5.4Updated 26 October 20265 min read

Henkan reads your BigQuery datasets with a Google Cloud service account and runs read-only SQL for you. It is the way to get raw, unsampled GA4 export data, with a cost cap your organisation controls.

Before you start#

You need a service-account key (JSON) for a Google Cloud project that can read your data. The steps below show where to click. Ask your data team for the key if someone else manages Google Cloud.

To do this you need Create Service Accounts and Project IAM Admin on the project to create the account and grant roles, and Service Account Key Admin to create the key (a project Owner has all three).

Create the service-account key#

Simplified views of the Google Cloud console; its look may differ slightly.

1. Open Service accounts. Go to console.cloud.google.com, pick the project in the project selector, then open IAM & Admin › Service accounts and select Create service account.

Google Cloudmaison-exemple-analytics ▾
1Project: maison-exemple-analytics
IAM & Admin
IAM
Service accounts 2
Roles
Organization policies
Service accounts
+ Create service account3
Email · Status · Name
IAM & Admin › Service accounts, in the project that will run the queries.
1Check the project selector shows the project that will run the queries.
2In the menu, open IAM & Admin › Service accounts.
3Select Create service account.

2. Name the account. Enter a name such as henkan-chat. Google fills in the Service account ID from it. Select Create and continue.

Google Cloudmaison-exemple-analytics ▾
Create service account
1
Service account details
Service account name
henkan-chat
1
Service account ID
henkan-chat
2
henkan-chat@maison-exemple-analytics.iam.gserviceaccount.com
Service account description (optional)
Read-only access for Henkan Chat
Create and continue3
2
Grant this service account access to project
3
Grant users access to this service account
Step 1 of Create service account.
1Enter a name, for example henkan-chat.
2Google fills in the ID from the name. You can't change it later.
3Select Create and continue.

3. Grant two read roles. Add BigQuery Job User (roles/bigquery.jobUser, runs queries) and BigQuery Data Viewer (roles/bigquery.dataViewer, reads tables). Select Continue, then Done.

Google Cloudmaison-exemple-analytics ▾
Create service account
✓
Service account details
2
Grant this service account access to project
Role
BigQuery Job User
1
Role
BigQuery Data Viewer
2
+ Add another role
Continue
3
Grant users access to this service account (optional)
Done3
Step 2 grants the roles on this project.
1In Select a role, search for and pick BigQuery Job User.
2Select Add another role, then pick BigQuery Data Viewer.
3Select Continue, skip the optional third step, then select Done.

Job User must be on the project that runs and pays for the queries. Data Viewer can instead be granted only on the GA4 export dataset, or on the project that holds it, if your data lives elsewhere. Give the account read roles only, so it can never change data. When you connect, Henkan checks both roles and tells you which one is missing.

4. Open the Keys tab. Back in Service accounts, select the email of henkan-chat, open Keys, then Add key › Create new key.

Google Cloudmaison-exemple-analytics ▾
henkan-chat
DetailsPermissionsKeysMetricsLogs1
Add key ▾2
Create new key
Upload existing key
No keys yet.
The service account's Keys tab.
1In the list of service accounts, select the email of henkan-chat, then open the Keys tab.
2Open Add key and select Create new key.

5. Create a JSON key. Keep JSON and select Create. Your browser downloads the key file. Google can't download it again, so keep it safe and never share it or put it in a shared folder.

Google Cloudmaison-exemple-analytics ▾
Create private key for "henkan-chat"
Downloads a file that contains the private key. Store the file securely because this key can't be recovered if lost.
Key type
◉JSONRecommended1
○P12
CancelCreate2
The key file downloads as soon as you select Create.
1Keep JSON as the key type.
2Select Create. The key file downloads once and can't be downloaded again: keep it somewhere safe and never share it.

6. Paste it in Henkan. Open the downloaded file in a text editor, copy everything, then follow Connect below.

Google Cloudmaison-exemple-analytics ▾
Explorer
▾ maison-exemple-analytics 1
▾ analytics_123456789 2
▦ events_ (92) 3
▦ events_intraday_20261021
▸ marketing_reporting
Finding the GA4 export dataset in BigQuery Studio.
1In BigQuery › BigQuery Studio, the Explorer pane lists projects. Expand the one that holds your data.
2The GA4 export is the dataset named analytics_ followed by your GA4 property ID.
3Its daily tables are events_YYYYMMDD, shown as one grouped line.

Connect#

Connecting BigQuery with a service-account key.
1
Name. Helps you recognise this connection.
2
Help text. Where to create the key, and which roles it needs.
3
Test and save. Checks the key and both roles before storing them.
  1. Open Tools In the sidebar, select Tools, then select BigQuery and Connect.
  2. Paste the key In Service-account key (JSON), paste the whole key file.
  3. Fill in the optional fields Project ID: the project billed for queries (defaults to the key's project). Location: for example EU or US (leave empty to let BigQuery detect it). Max GB per query: default 50 GB.
  4. Select Test and save Henkan checks the key and the roles, then stores the key encrypted. It is never shown again.

What you can ask#

  • "Which datasets do we have? Find the GA4 export for Maison Exemple FR."
  • "Daily users, sessions, purchases and revenue from the GA4 export for September, unsampled."
  • "Show the schema of events_20261001."
  • "Revenue by item category last week from the GA4 export. Aggregate in SQL."

What Chat can and can't do#

ToolWhat it doesRead or writeAsks first?
List projectsGoogle Cloud projects the service account can see.ReadNo
List datasetsDatasets of a project. GA4 exports are named analytics_<property id>.ReadNo
List tablesTables and views. GA4 daily tables appear as one events_* line with the first and last day.ReadNo
Get table schemaColumns, types, nested fields, row count, size and partitioning.ReadNo
QueryRuns one read-only GoogleSQL SELECT, after a dry run, within the connection's limits.ReadNo
GA4 daily summaryDaily users, sessions, page views, purchases and revenue from a GA4 export.ReadNo

Only single SELECT queries run. Henkan refuses any other statement.

Limits and good to know#

Usage and limits. Open Tools › BigQuery › Advanced settings › Usage and limits. It shows this month's usage (GB read out of the budget, number of queries, and an estimated cost at Google's on-demand list price, labelled as an estimate). It also lists the month's largest queries and who ran them: a person, a flow or an MCP client. Organisation owners can change the limits; members see the same figures read-only.

LimitDefaultWhat it does
Max per query50 GBA query whose dry run estimates more is refused.
Monthly budget500 GBOnce a query would take the calendar month (UTC) over the budget, BigQuery queries pause until the 1st of next month, or until an owner raises the budget.
Alert at80%Organisation owners get one email per connection and month when usage reaches this share of the budget.

Every BigQuery answer tells the AI how much budget is left. A refused query tells it to narrow the query (fewer days, fewer columns, aggregate in SQL) or to ask an organisation admin. Cached results are free and count as 0 GB. BigQuery bills at least 10 MB per query and per table it references.

Who pays. Google bills the data each query reads to your own Google Cloud project: the Project ID you entered, or the key's project. Henkan does not charge for BigQuery data; your Henkan plan covers the AI requests only. The used figure is what BigQuery reports as billed, so it can differ slightly from your Google invoice. The estimate uses Google's on-demand list price of $6.25 per TiB; the first 1 TiB of queries each month is free per billing account, and capacity (editions) pricing, regions and discounts change what you really pay.

GA4 exports. Export figures differ a little from the GA4 interface (consent modelling, user definitions, thresholds). For report-style questions on one property, Google Analytics 4 is often quicker.

Troubleshooting#

Error or symptomFix
The service account cannot read datasetsGrant it BigQuery Data Viewer (roles/bigquery.dataViewer).
The service account can read data but cannot run queriesGrant it BigQuery Job User (roles/bigquery.jobUser) in the billed project.
Only SELECT queries are allowedHenkan only reads. Ask for a SELECT instead.
A query is refused for its sizeNarrow it: fewer days, fewer columns, or aggregate in SQL. An owner can raise Max per query.
BigQuery queries are paused for the monthThe monthly budget is reached. An owner can raise it in Usage and limits, or wait until the 1st.
Key creation is blocked in Google CloudAsk your organisation admin for an exception to iam.disableServiceAccountKeyCreation.

Sources#