You can use functions, charts, extracts, pivot tables, and refresh BigQuery data in Google Sheets.
Important: To access BigQuery data in Google Sheets, you need access to BigQuery. Learn how to get started with BigQuery.
- On your computer, open a spreadsheet in Google Sheets that is connected to BigQuery data.
- At the top, click Chart.
- Choose where to place it.
- Click Create.
- At the right, choose your other settings.
- At the bottom right, click Apply.
Tip: To update the chart based on the latest BigQuery data, at the bottom of the chart, click Refresh.
Add a pivot table- On your computer, open a spreadsheet in Google Sheets that is connected to BigQuery data.
- At the top, click Pivot table.
- Choose where to place it.
- Click Create.
- At the right, choose your settings.
- At the bottom right, click Apply.
Tips:
- Pivot tables can currently support up to 100k results.
- To limit the amount of data you see in your pivot table, specify the number of rows or columns to return. Update “sort by” and “order” to specify which rows or columns are returned.
- To add calculated fields with a SUM or custom formula, in the side panel, next to “Values,” click Add Calculated field. Learn how to add Calculated fields in pivot tables.
- To update to the latest BigQuery data, at the bottom of the pivot table, click Refresh.
- To view values at intervals within a range, use histogram grouping. Values that are higher than the maximum and lower than the minimum are grouped together.
You can use some functions with BigQuery data.
- On your computer, open a spreadsheet in Google Sheets that is connected to BigQuery data.
- At the top, click Function.
- Choose a function from the list.
- Select where to place the function.
- Click Create.
- Choose your reference column and add any other required parameters.
- Press Enter.
- Put your mouse over a cell that contains the formula, and click Apply changes.
Tip: You can also type functions inside any cell.
You can analyze data offline, or reference individual values and ranges within functions. You can pull up to 500k rows or 10MB of your BigQuery data. If you try to pull more than this limit, only the first 500k rows will appear.
If the number of rows are:
- Less than or equal to 50k, then there’s no cell limit.
- Greater than 50k but less than or equal to 500k, then the number of cells must be less than or equal to 5m.
- Greater than 500k, then the data pull isn’t supported.
- On your computer, open a spreadsheet in Google Sheets that is connected to BigQuery data.
- Select an option:
- At the top, click Extract.
- Choose where to put it.
- Click Create.
- At the right, under "Extract editor," add columns, filters, and sort settings.
- At the bottom left of the extract, click Apply changes.
You can apply a calculation to all rows by adding a calculated column.
- On your computer, open a spreadsheet in Google Sheets that is connected to BigQuery data.
- At the top, click Calculated column.
- Enter a formula using column names and supported Sheets functions. You can use basic math operations like =price * quantity or manipulate text with =RIGHT(orderId, 4).
- Click Add.
- On the bottom left of the Sheet, click Apply.
Tip: To view column stats, at the top right of a column, click Down arrow View Column Stats.
- IF (can be used to detect potential errors, such as division by zero)
- AND
- OR
- NOT
Lookup Functions
- ROWS
- VLOOKUP: Learn how to use VLOOKUP in Connected Sheets.
- XLOOKUP: Learn how to use XLOOKUP in Connected Sheets.
Filter Functions
- FILTER
- LEFT, RIGHT, MID
- UPPER, LOWER
- LEN
- CONCAT (&)
- +, -, *, /
- The negative sign (-) and the percent sign (%)
Math Functions
- ROUND
- POW/POWER (^)
- SQRT
- ABS
- LOG, LN, LOG10
Dates and Times
- DATE, TIME
- YEAR, MONTH, DAY
- HOUR, MINUTE, SECOND
- =, <>
- >, >=, <, <=
- SUM
- SUMIF
- SUMIFS
- COUNT
- COUNTBLANK
- COUNTIF
- COUNTIFS
- COUNTUNIQUE
- COUNTUNIQUEIFS
- MIN
- MINIFS
- MAX
- MAXIFS
- AVERAGE
- AVERAGEIF
- AVERAGEIFS
- VAR
- VARP
- STDEV
- STDEVP
Other
- ISBLANK (returns whether or not the given argument is NULL)
Refresh your data
- On your computer, open a spreadsheet in Google Sheets that is connected to BigQuery data.
- At the bottom, next to "Refresh" click More Refresh options.
- To the right, under "Refresh options," click the items you want to refresh. To refresh all of the data, at the bottom right, click Refresh all.
Important: Scheduled refreshes of Connected Sheets don't propagate any end-user context such as IP address or device information. Virtual Private Cloud Service Controls (VPC-SC) perimeters that use end-user context to restrict access will cause scheduled refreshes to fail.
A scheduled refresh will update all objects and data sources at a specific, preset time.
Important:
- A scheduled refresh will run as the user that set up the schedule. If another user adds or updates an existing datasource, the schedule will automatically pause. To unpause, contact the schedule owner or take over the refresh.
- Objects in the preview or failed state will not refresh with a scheduled refresh.
- On your computer, open a spreadsheet in Google Sheets that is connected to BigQuery data.
- At the bottom, next to "Refresh" click More Refresh options.
- At the bottom of the sidebar to the right, under “Scheduled refresh,” click Setup now.
- Choose your refresh frequency.
- Click Save.
To run a scheduled refresh as yourself instead of the original owner, you can take over a refresh.
- On your computer, open a spreadsheet in Google Sheets that is connected to BigQuery data.
- At the bottom, next to "Refresh" click More Refresh options.
- At the bottom of the sidebar to the right, under “Scheduled refresh,” click Edit.
- Choose your refresh frequency.
- Click Save to transfer the scheduled refresh ownership to you.
View query details and cancel a query
Editors of a spreadsheet and users with the required BigQuery permissions can cancel a query that is running.
To view query details for any database objects:
- On your computer, open a spreadsheet in Google Sheets that is connected to BigQuery data.
- At the bottom pop-up Refresh button, click info to see query details in BigQuery.
- Note: won’t show up if the data can be obtained without running a query. Learn more about exploring table data without running a query.
- When you refresh, similar formulas may be combined into one query that computes results for all combined formulas.
To cancel a query for any database objects:
- On your computer, open a spreadsheet in Google Sheets that is connected to BigQuery data.
- When a query is running or pending: At the bottom pop-up Refresh button, next to “Running query” or “Query pending”, click Cancel next to the calculated running time.
- Click Confirm.
You can also cancel a query from Refresh options sidebar:
- On your computer, open a spreadsheet in Google Sheets that is connected to BigQuery data.
- At the bottom, hover over the refresh icon , next to "Refresh" click More Refresh options.
- To cancel running refresh individually, next to each item, click Cancel.
- Click Confirm.
- If you do not have the required BigQuery permission for a BigQuery dataset, the action to cancel a query cannot be completed.
- A query that failed due to a Sheets timeout may keep running in the database.
- If you cancel a query that has multiple formulas, all of the other formulas in the query are also canceled.
Next: Write & edit a query with BigQuery data in Sheets