Postgresql to Google Sheets PostgreSQL + Google Spreadsheets =

KPIBees Google Add-on.

How to connect PostgreSQL to Google Sheets

If you are constantly exporting PostgreSQL data to Google Sheets in order to create business reports and you’re wondering if there’s a simple way to solve this challenge, then you’ve arrived at the right place!

One extremely easy way to connect PostgreSQL to Google Sheets is KPIBees. To write SQL queries directly in a Google spreadsheet, just install this Google Sheet Add-on. You don’t need to write any code or Google Apps Scripts!

With this Add-on, you can export PostgreSQL data to Google Sheets and bring the outputs of your queries directly in the selected spreadsheet cell! Additionally, you can schedule automatic refresh times so that the data is always up to date when you open your spreadsheet! 

Export PostgreSQL query to Google Sheets


To get started, please follow the next steps:

Step 1: Install the KPIBees Gsuite Marketplace Sheets Add-on.

Step 2: Grant access to KPIBees on your Google account. KPIBees is GDPR compliant and your data is safe with us!

Step 3: Open any Google Sheet and run KPIBees from the Add-ons menu. First click on Launch, then from the same menu click on Create Query.

Google Sheet Add-on location toolbar.


Step 4: Click on the PostgreSQL integration.


Google Sheets PostgreSQL integration.


Step 5: Add a new Database Connection in order to connect your PostgreSQL database.  Of course, you can connect multiple database to the same google spreadsheet.


Add PosgreSQL database connection to Google Sheets.


Step 6:  Next you need to add your database credentials and then click on Create. It’s import to note that your database must be accessible from our server, so please make sure to enable external connections on your database server for our server IP. Also, it’s a good idea in terms of security to use a read-only user for the connection and, perhaps, even a user that doesn’t have access to all your tables.


Connected spreadsheet successfully to PostgreSQL database.


Step 7: After you’ve successfully added your database connection, you can start writing sql queries and bring the data into your selected spreadsheet cell! A simple query to start with is select * from table_name – where table_name is your desired table.


Write PostgreSQL query in any Google Spreadsheet.


Step 7: After you’ve successfully added your database connection, you can start writing sql queries and bring the data into your selected spreadsheet cell!



PostgreSQL query output to spreadsheet cell.


Step 8: It’s possible to create as many queries as you want, so feel free to create more queries and build your business dashboard! Also, you can add queries from various other data sources, such as XML, JSON, Google Analytics, MySQL and more! 


Manage your create PostgreSQL queries within Google Sheets.


Schedule automatic PostgreSQL queries to Google Sheets 

Once you’ve set up your database business report in a spreadsheet, you have the ability to schedule automatic updates to your PostgreSQL queries. This way, your data will always be up to date when you visit your Google Sheets. To enable this, go to the Notifications & data refresh menu and schedule your refresh trigger. Additionally, you can also have an email sent to you once a refresh happens with the data in a pdf format.
Automatically set refresh triggers for PostgreSQL queries in Google Sheets.


Furthermore, KPIBees supports integrations that enable you to create incredible business reports that include your PostgreSQL database:  Here are all the Google Sheets integrations that KPIBees supports: