Database Connector

The Database Connector has an easy-to-use interface that lets you connect to any Google Cloud SQL MySQL, MySQL, Microsoft SQL Server, and Oracle database directly from your Google Sheet. Import/Export data, live test, automate queries, chain different queries.

Just configure the connection to your database and you can run any statement and get the data back.

It uses the Google JDBC service, a wrapper around the standard Java Database Connectivity technology.

Configure a connection

Click Add-ons -> Database Connector -> Manage Connections

The Connection Management pane will appear. You can use it to create, edit, copy, or delete your saved database connections. Click Add New to add a new connection.

To add a new connection you need to configure the Url, User, Password, and give it a name. You can also click Test to check if the connection is successful.

In order for the Google JDBC service to be able to connect to your database, you need to whitelist certain IP ranges. If the database is open to the public this will not be necessary, but this is seldom the case. The full range of IP addresses and documentation of the JDBC service can be found on the Google JDBC Guide.

64.18.0.0 - 64.18.15.255
64.233.160.0 - 64.233.191.255
66.102.0.0 - 66.102.15.255
66.249.80.0 - 66.249.95.255
72.14.192.0 - 72.14.255.255
74.125.0.0 - 74.125.255.255
173.194.0.0 - 173.194.255.255
207.126.144.0 - 207.126.159.255
209.85.128.0 - 209.85.255.255
216.239.32.0 - 216.239.63.255

Configure a query

Click Add-ons -> Database Connector -> Add New Query to open the New Query screen

Select one of your configured database connections.

In the “Query” area you can write your SELECT query. The syntax supports adding references to cells so you can write dynamic queries. Format for a cell reference: +++SheetName!CellReference+++

Example: Select * from Employees WHERE id=+++MySheet!A1+++ , where MySheet is the name of a sheet and the A1 cell contains a table name.

Type: you can run a query(select) or a statement(select, insert, update). Only queries return a dataset to import into your Google Sheets!

You can Test your configuration first to get the desired results, then save them for later use or for scheduling/chaining using the Schedule tab.

Leave a Reply

Your email address will not be published. Required fields are marked *