This post has been updated, Check here
Step 1: Create a spreadsheet within your Google Drive.
- How to insert script
Step 3: Adding your MySQL database credentials and correct table names
Jdbc.getConnection('jdbc:mysql://127.0.0.1:3306/employee_db', 'username', 'pass')
Step 3.1: Replace the place holder credentials (host, database, user, pass) for MySQL, Also change MySQL query as per your MySQL database.
Step 4: Run the Script.
Step 4.1: Run the script from top menu "Run" and it will pull data from your database.
You are all set to run the script!!
Script will take some time to pull data from database depending on connection speed and data size.
Additional Step: Connection error & White listing Google IP’s
Script from Google Docs connects to your MySQL database. In some cases your MySQL database will not allow this unless you white list the visiting servers ip. Google has provided a list of IP’s you need to white list.
Below is the list of Google IP’s you need to white-list. More details:
- 220.127.116.11 - 18.104.22.168
- 22.214.171.124 - 126.96.36.199
- 188.8.131.52 - 184.108.40.206
- 220.127.116.11 - 18.104.22.168
- 22.214.171.124 - 126.96.36.199
- 188.8.131.52 - 184.108.40.206
- 220.127.116.11 - 18.104.22.168
- 22.214.171.124 - 126.96.36.199
- 188.8.131.52 - 184.108.40.206
- 220.127.116.11 - 18.104.22.168
The script is written for a simple query but can be customized to any extend. It can also pull data from other tables.