how to query my database and have it be outputted on a Google Sheet so that someone can edit this data and then have it reflected back in MySQL?
Asked Answered
Y

2

5

I’d like to push some data from MySQL into Google Sheets. Once I’ve edited my data in Google Sheets, I’d like to push my edited data back into MySQL. Ideally, I’d even like to schedule it to update it every hour, so my data is always live and matches what's in my MySQL.

I’ve looked into Google Sheets Script and it seems that it enables you to type in a SQL query into a cell in Google Sheets and retrieve your queried data. However, the main issue, even though I find a proper way to export my data to sql, is that I have hundreds of tabs across multiple spreadsheets and I’d like to find a way to avoid to manually repeat this job for every tab.

Please have in mind that it is for someone on my team who can’t figure out querying with SQL, has a hard time navigating MySQL, and that I don’t want to train in SQL. I would just like this person to edit Google Sheets and these edits to be reflected back in MySQL, without this person ever having to go into my SQL database.

Ybarra answered 5/8, 2019 at 23:59 Comment(1)
Take a look at JDBCAnnulus
S
5

I think you can also use Google Apps Script to push back the data in mySQL. However, I don't know how scalable this solution would be.

Some tools exist to export data from SQL to Google sheets, like Zapier and add-ons such as Kloud and Blockspring. The thing with Blockspring is that it's targeted to people that are familiar with SQL queries. And none of those solutions allow you to push the edit data back to your database (at least, that I know of... would be very interested if it is otherwise).

So an option would be to use Actiondesk to sync your SQL database with your Google Sheets. You can schedule the synchronisation every hour (even every ten minutes actually), and it would be easy to add new sheets/tab anytime you need to (it's just a matter of few clicks).

Hope this helps!

Disclaimer: I am a back-end engineer at Actiondesk and personally implemented the Googlesheets integration, so I might be kind of biased (but at the same time, I might be the best person to answer your wildest questions on that regard so feel free to shoot them)!

Shelli answered 6/8, 2019 at 2:28 Comment(1)
You can do everything you want with Google Apps Script and a JDBC connection. If if you’re writing to a lot of spreadsheets and a lot of sheets I’d be inclined to put one sheet in each spreadsheet as the place to have all of your data reside and then you can grab the data from that one sheet to all of the other sheets with standard formulas.Annulus
A
1

It's possible to connect to MySQL with Apps Script, but you need to disable your firewall or whitelist all of Google's IP addresses (which are subject to change). As you mentioned you'll also need to set up the script for every Sheet or release the script as an add-on. You are also likely to run into difficulty writing back to the database (e.g. handling date formats).

SeekWell lets you automatically send data from SQL to Sheets and can also sync data from Sheets back to a database. It's built specifically to handle this use case, so it will get you up and running faster, but it's a commercial / paid product.

Disclaimer: I built this.

Apterous answered 7/1, 2020 at 14:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.