In 2021, it’s important for the product nerds, marketers and smart spreadsheet users to connect to PostgreSQL(world’s most advanced open source database) and pull data to Google Sheets . Google Sheets has become indispensable in the life of next generation Businesses.
Whatever be the data that you are working with, it’s easier to create reports, analyse data and share them easily with Google Sheets. This amount of flexibility has made it extremely suitable for managing and tracking the day to day operations of a Business.
However there are few limitations that Google Sheets doesn’t solve out-of-the-box. One such limitation is the ability to get your data from external database like PostgreSQL database into Google Sheets.
We will show you how to overcome that and also free up your time by automatically running your queries and emailing your reports.
There are few plugins out there to connect PostgreSQL to Google Sheets, but we found their design and functionality very very buggy and incomplete. They would have been good options if we were in the year 1990. For fast paced users looking to spend less time and get immediate results we created “Two Minute Reports”.
In a matter of minutes without a single line of code, Two Minute Reports makes it easy to connect and send data from PostgreSQL database to your Google Sheets.
Step 1: Install and Launch Two Minute Reports
This simple add-on for Google Sheets enables you to pull data from PostgreSQL database into Google Sheets. Install it from the GSuite marketplace here. Do follow the steps below and experience the full benefits before buying Two Minute reports.
Install Two Minute Reports, if you have not done already.
Sign in to any Google Sheet and go to Add-ons -> Get add-ons.
Search for Two Minute Reports and select Install.
Review and accept the permissions necessary to run Two Minute Reports. Two Minute Reports will be installed for you with the e-mail you are sign in to Google Sheets.
Open Google Sheets and go to Extensions -> Two Minute Reports -> Launch.
Step 2: Connect PostgreSQL to Google Sheets
Two Minute Reports allows you to Add data from a growing list of different Data Sources. You can add your PostgreSQL data source by going to the Data Sources section and filling in your database details.
Press “Test Connection” once you are ready, your credentials will be validated and saved for future use.
After adding your PostgreSQL Data Source, you can add unlimited number of queries using the same Data Source. Your credentials are securely encrypted and stored within your Google Account. This makes sure your data does not leave the Google Servers and is not readable by anyone except you. Even when you share your Google Spreadsheet with others, they cannot read your credentials.
If you get an error message, you might have to check your credentials or configure your PostgreSQL database to whitelist the IP address of our Amazon Serve IP Addresses 220.127.116.11. Please note you can only run SELECT queries in Two Minute Reports, restricting you or anybody from your team from modifying critical database data accidentally.
Step 3: Add SQL queries to Google Sheets
Once you have added a Data Source, you can access it from any new or old spreadsheet within your Google Account. This makes it easy for you to connect to your PostgreSQL database and create queries from different spreadsheets without having to re-enter all the credentials.
You can go to the Data Queries section and add your PostgreSQL query. Start by selecting your newly added Data Source and enter your query in the dark SQL editor. Note that for security reasons we only allow “select” based sql queries to be executed in your PostgreSQL database.
\When ready press “Run query”, and data will be fetched from your database and stored in the specified spreadsheet in Google Sheets.
Once a query is added it gets saved in your spreadsheet. You can then rerun the query or modify it and reuse easily within the Data Queries section.
Also do note that the queries are securely stored locally in your Google Sheets. And so it can only be accessed from within the Google Sheets that created it. This makes it easier to manage multiple queries properly within different google sheets. This is different from how we store Data Sources, which can be accessed from any spreadsheet within that Google account.
Once you have fetched data once, you might want to get new data from your PostgreSQL database at periodic intervals. You can do this creating a new schedule under the “Schedule Reports” section. You can schedule updates hourly, daily, weekly or monthly based on your need.
Step 4: (Optional) Schedule data Refresh and Email
Once you have fetched data once, you might want to get new data from your database at periodic intervals. You can do this creating a new schedule under the “Schedule Reports” section. You can schedule updates hourly, daily, weekly or monthly based on your needs.
You could also create a report and ask Two Minute Reports to email that report with updated data automatically. Under the email section enter the email Id of the recipients and save your new schedule.
When the time comes, Two Minute Reports will automatically fetch new data from your queries, and email your report to the said recipients. You have freed a lot of your time from mundane reporting tasks.
There are other features with Two Minute Report’s schedule refresh or data refresh feature. You may read our guide How to Refresh Data Automatically in Google Sheets.
Try Two Minute Reports for Free by installing from the GSuite marketplace, and start pulling data from PostgreSQL to your Google Sheets. Cheers!