How to use BigQuery in Google Sheets and control your costs?

BigQuery is a fully managed, petabyte-scale analytics data warehouse that enables businesses to analyze all their data very quickly. Google Sheets is a popular spreadsheet program that allows users to create and edit spreadsheets online. By connecting BigQuery to Google Sheets, you can access and analyze your BigQuery data directly in Google Sheets. This can be useful for a variety of tasks, such as creating dashboards, reports, and visualizations.

Connect to Bigquery

Here is a step-by-step guide on how to use BigQuery in Google Sheets:

  • Open a Google Sheets spreadsheet
  • Click on the Data menu and select Data connectors
  • Click on Connect to BigQuery
  • Select the BigQuery project and dataset that contains the table you want to connect to
  • Select the table you want to connect to and click on Connect

Get the queries of Google Sheets

Now, everytime you "Refresh" the sheets, it will run a query in Bigquery. You are wondering what are these queries and how much they cost? When Google Sheets use Bigquery it adds some labels to the query.

If you wonder how to do it yourself, check this. Simply follow the previous link and add the "sheet_connector" label in Biq Blue using the environment variable BIQBLUE_LABELS=sheet_connector.

Now you can see how much cost using Bigquery in Google sheets, and optimize the data to avoid heavy cost.

Conclusion

By following these tips, you are going to connect Google Sheets with Bigquery and monitor the queries and the cost of Google Sheets.

⭐ Additional tips

  • Use labels to monitor your Bigquery usage
  • Explore how your tables are queried