If you’ve ever tried to get MySQL data into Google Sheets, you’d probably agree that the process isn’t a walk in the park.
Even though you can copy/paste data cell by cell, the real nightmare begins when you have to deal with a large amount of data and/or keep your data fresh.
That’s why in this article, we’ll show you how to export data from MySQL (or any other database for that matter) to Google Sheets in a few clicks.
All you need to do is follow these three simple steps. 👟
Step 1: Install the Supermetrics add-on
To begin, you need to get the Supermetrics add-on for Google Sheets. There are two ways you can do this:
- Install the add-on directly from the Google Workspace Marketplace
- Or, open a fresh Google Sheet, click on ‘Add-ons’ → ‘Get add-ons,’ then search for Supermetrics
Psst! By installing the add-on, you’ll start your free 14-day Supermetrics trial.
After that, you’ll find Supermetrics under the ‘Add-ons’ menu.
Step 2: Export MySQL data to Google Sheets
Next, we’ll use the Rfam public database — a database of non-coding RNA families — as an example to show you how to get your data to Google Sheets.
Let’s launch the Supermetrics sidebar. Click on ‘Add-ons’ → ‘Supermetrics’ → ‘Launch sidebar.’
When the sidebar opens, you need to build a query.
- Data source: Database.
- DB type: here, you’ll find a list of different databases, including:
- SQL Server
- Amazon RDS Aurora
- Amazon RDS MariaDB
- Amazon RDS MySQL
- Amazon RDS Oracle
- Amazon RDS PostgreSQL
- Amazon RDS SQL Server
- Amazon Redshift
- Google Cloud SQL for MySQL
- Microsoft Azure MySQL
In this case, we’ll select MySQL.
Next up, you’ll be asked to fill in the following information:
- DB address (or host)
- DB port
- DB name
Check the ‘SSL’ box if your database requires Secure Sockets Layer (SSL).
Remember my Rfam example? My query looks like this. 👇
Once you’re done, click on ‘Test connection’ to connect to your database.
- Database query
- Query SQL: here, you need to write the SQL query you want to run.
Back to my example. Let’s say I want to pull all snoRNA families found in mammals. I’ll use this query:
SELECT fr.rfam_acc, fr.rfamseq_acc, fr.seq_start, fr.seq_end, f.type FROM full_region fr, rfamseq rf, taxonomy tx, family f WHERE rf.ncbi_id = tx.ncbi_id AND f.rfam_acc = fr.rfam_acc AND fr.rfamseq_acc = rf.rfamseq_acc AND tx.tax_string LIKE '%Mammalia%' AND f.type LIKE '%snoRNA%' AND is_significant = 1 -- exclude low-scoring matches from the same clan
Happy with your query? Great. Now, click on ‘Get data to table’ and wait for Supermetrics to load your data to Google Sheets.
Aaand… Ta-da! 🎉 Here’s what my spreadsheet looks like. 👇
With Supermetrics, you can easily pull data from multiple sources into a single spreadsheet — without ever leaving your spreadsheet.
Move data from multiple sources into Google Sheets in minutes
Check out all data sources Supermetrics integrates with.
Step 3: Set up an automatic data refresh
Here comes the best part. 🤩
Once you’ve got your data to Google Sheets with Supermetrics, you don’t have to worry about updating your data manually ever again. You can easily set up a data refresh and let Supermetrics do the work for you.
To do that, click on the ‘Schedule’ tab on your sidebar.
Next, click on ‘Add trigger.’ From here, you can choose how often you want to update your data and if you’d like to receive an email notification when that happens.
That’s literally it!
Such a quick and painless way to export your MySQL data to Google Sheets, right?
Now it’s totally up to you to decide how you want to analyze your data and what kinds of reports you want to build.
Happy reporting! 📈