I\'m trying to auto-populate some raw data on a sheet in my google sheets file with a query.
It doesn\'t look like sheets has any built in functionality to do so lik
You have couple options:
1. Build your own connector / addon
You can build your own connector using Google app script (https://developers.google.com/apps-script/guides/sheets). I'd recommend this tutorial for addon development https://youtu.be/6jcc3xm7aRU.
To connect to your database, you can either use the JDBC services (https://developers.google.com/apps-script/guides/jdbc) like @abielita suggested, or use a separate database connectors, like psycopg2 or node-postgres if Apps Script JDBC service does not support your database. Run it on some server, front it with REST API and fetch the data from Google sheet.
2. Use addon
There are many addons in the market that are trying to solve this exact problem. You can find them by searching "connect database to google sheets" on G Suite Marketplace (https://gsuite.google.com/marketplace).
If you don't want to roll your own solution, check out SeekWell. It allows you to connect to databases and write SQL queries directly in Sheets.
A few other features:
Disclaimer: I made this.