Connect Google Sheets To A Database

439 views
Skip to first unread message

Anthony Apollis

unread,
Feb 26, 2021, 4:58:14 AM2/26/21
to Google Apps Script Community

I would like to connect to a mysql database that is a localhost connection and not on a internet service provider.
How do i connect? Do you use "localhost or your ip"?

I tried it and it does not work. Also, how do i open a port for access? Is the port connections blocking me from succeeding regarding this?

dimud...@gmail.com

unread,
Feb 26, 2021, 7:09:41 AM2/26/21
to Google Apps Script Community
Apps Script's JCBC library can only connect to database servers that are accessible from the web. So it cannot connect directly to your local database unless you host it online. 
But there are services that allow you to do that. ngrok is one such service. 

Anthony Apollis

unread,
Feb 26, 2021, 7:25:36 AM2/26/21
to google-apps-sc...@googlegroups.com
Thank you for your response. I didnt know that. If im connecting to database, remotely e.g via vpn. Will that work?

Anthony

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/f7915d85-b820-4482-b8cb-67790e362eecn%40googlegroups.com.

Clark Lind

unread,
Feb 27, 2021, 9:27:41 AM2/27/21
to Google Apps Script Community
No, not likely. Because Apps script is running on Google servers (not on your machine), the Google servers have to reach out to make a connection to the database wherever it happens to be. If you are using a router and have control over it, most routers these days have port forwarding capabilities. But that is beyond the scope of this group. 
Reply all
Reply to author
Forward
0 new messages