Use this guide to connect your SQL database to Supermetrics, and seamlessly add its data to your reports. The database connector is only available in Google Sheets.
Use the database connector to connect to a data source Supermetrics doesn't support at the moment, and also for custom in-house data. Then, transform or combine data before adding it to your reports.
Tables that contain all data in the database and Views that contain the results of a query in a virtual table are supported.
SSH connections and write-specific SQL functions are not supported for the SQL database connector.
Supported database types:
- MySQL
- Oracle
- MariaDB
- PostgreSQL
- Microsoft SQL Server
- Amazon Redshift
- Google Cloud SQL for MySQL
- Microsoft Azure SQL
Before you begin
Check the access requirements with your database administrator before using the database connector.
Database connector configuration
Before connecting, make sure you have the following information available:
- DB type – The database type or technology being used
- DB address – IP or URL to the SQL server
- DB port – Port number the server is expecting connections through
- Database name – Name of the data based to connect to
- Username – Account that has permissions to access the database
- Password – Password for the account
- Use SSL – Setting that allows SSL to be used, if the server connection requires it.
IP allowlisting
To use Supermetrics with your database, your database needs to accept connections from specific IP addresses. See the list of IP addresses to allowlist.
Note
If the IP addresses listed in the article don't work and you get an Access denied error, try the Google IP addresses listed below. For example, AWS accepts a comma-separated list.
- 8.8.4.0/24
- 8.8.8.0/24
- 8.35.200.0/21
- 34.0.0.0/15
- 34.2.0.0/16
- 34.3.0.0/23
- 34.3.3.0/24
- 34.3.4.0/24
- 34.3.8.0/21
- 34.3.16.0/20
- 34.3.32.0/19
- 34.3.64.0/18
- 34.3.128.0/17
- 34.4.0.0/14
- 34.8.0.0/13
- 34.17.0.0/16
- 34.18.0.0/16
- 34.22.64.0/18
- 34.22.128.0/17
- 34.31.0.0/16
- 34.32.0.0/11
- 34.64.0.0/19
- 34.96.0.0/18
- 34.98.0.0/18
- 34.98.136.0/21
- 34.98.144.0/20
- 34.98.160.0/19
- 34.98.192.0/18
- 34.99.0.0/16
- 34.100.0.0/17
- 34.101.0.0/20
- 34.101.16.0/23
- 34.101.19.0/24
- 34.101.28.0/22
- 34.103.0.0/16
- 34.104.0.0/20
- 34.104.16.0/21
- 34.104.24.0/23
- 34.104.26.0/24
- 34.104.28.0/22
- 34.104.32.0/20
- 34.104.48.0/24
- 34.104.53.0/24
- 34.104.54.0/23
- 34.109.0.0/16
- 34.110.0.0/17
- 34.112.0.0/14
- 34.116.8.0/21
- 34.116.16.0/20
- 34.116.32.0/19
- 34.118.208.0/20
- 34.118.224.0/20
- 34.119.0.0/16
- 34.124.64.0/19
- 34.124.96.0/20
- 34.126.0.0/18
- 34.126.224.0/19
- 34.127.128.0/19
- 34.127.160.0/20
- 34.127.176.0/24
- 34.127.181.0/24
- 34.127.182.0/23
- 34.127.192.0/18
- 34.128.0.0/18
- 34.128.192.0/18
- 34.140.128.0/24
- 34.143.0.0/17
- 34.144.0.0/17
- 34.144.128.0/18
- 34.152.64.0/18
- 34.152.128.0/17
- 34.153.0.0/16
- 34.156.0.0/16
- 34.157.10.0/23
- 34.157.86.0/24
- 34.157.120.0/21
- 34.157.138.0/23
- 34.157.214.0/24
- 34.157.218.0/23
- 34.157.248.0/21
- 34.158.0.0/16
- 34.166.0.0/15
- 34.177.0.0/16
- 34.178.0.0/15
- 34.180.0.0/14
- 34.184.0.0/13
- 35.187.128.0/20
- 35.190.96.0/20
- 35.190.240.0/20
- 35.191.0.0/16
- 35.199.128.0/20
- 35.201.32.0/21
- 35.201.40.0/24
- 35.201.42.0/23
- 35.201.44.0/22
- 35.201.48.0/20
- 35.203.192.0/20
- 35.203.208.0/23
- 35.203.220.0/22
- 35.203.224.0/21
- 35.203.240.0/20
- 35.206.0.0/21
- 35.206.8.0/23
- 35.206.12.0/22
- 35.206.16.0/20
- 35.218.0.0/16
- 35.219.192.0/19
- 35.220.28.0/23
- 35.220.30.0/24
- 35.229.0.0/20
- 35.230.192.0/19
- 35.230.224.0/20
- 35.235.128.0/18
- 35.235.192.0/20
- 35.235.208.0/21
- 35.235.224.0/19
- 35.242.28.0/23
- 35.242.30.0/24
- 35.243.16.0/20
- 35.243.48.0/21
- 64.15.112.0/20
- 64.18.0.0/20
- 64.233.160.0/19
- 66.22.228.0/23
- 66.102.0.0/20
- 66.249.64.0/19
- 70.32.128.0/19
- 72.14.192.0/18
- 74.114.24.0/21
- 74.125.0.0/16
- 104.154.0.0/20
- 104.154.112.0/24
- 104.154.122.0/23
- 104.154.124.0/22
- 104.155.240.0/20
- 104.196.64.0/24
- 104.196.72.0/21
- 104.196.80.0/20
- 104.199.64.0/23
- 104.199.240.0/23
- 104.237.160.0/19
- 107.178.192.0/20
- 107.178.224.0/20
- 108.170.192.0/18
- 108.177.0.0/17
- 130.211.0.0/22
- 136.112.0.0/12
- 142.250.0.0/15
- 146.148.0.0/23
- 172.110.32.0/21
- 172.217.0.0/16
- 172.253.0.0/16
- 173.194.0.0/16
- 192.178.0.0/15
- 193.186.4.0/24
- 199.36.154.0/23
- 199.36.156.0/24
- 199.192.112.0/23
- 199.192.114.0/24
- 199.223.237.0/24
- 199.223.238.0/23
- 207.126.144.0/24
- 207.223.160.0/20
- 208.65.152.0/22
- 208.68.108.0/22
- 208.81.188.0/22
- 208.117.224.0/19
- 209.85.128.0/17
- 216.58.192.0/19
- 216.73.80.0/20
- 216.239.32.0/19
Instructions
Make sure you've installed the Supermetrics add-on before you connect.
- Open a new Google Sheets file.
- Navigate to Extensions → Supermetrics → Launch sidebar to open Supermetrics.
- Click Create new query.
- Under Data source, select Database.
- Fill in the information for your connection. See database connector configuration above for more details.
- Click Test connection to verify the configuration.
- Click Save.
- Write your SQL statement in the Query SQL box.
- Click Get data to pull your data.
More resources
- Learn about advanced settings, best practices, and troubleshooting tips for Supermetrics for Google Sheets.
- Learn how to use the "Combine new results with old" setting in Google Sheets.