Forums

Google Sheets connect to PA MySQL

All, Anyone have success or advice on how I can create a macro/script in google sheets to connect with my PA MySQL database? What I am looking for is a script that I can run as a custom function in one of my google sheets that selects data from my PA MySQL db.

Any direction is appreciated.

I'm interested in hearing how this turns out. Have you tried something like this:

// make the connection
 var connection = Jdbc.getConnection("jdbc:mysql://[database URL or IP]:[port number]/[database name]", "[user name]", "[password]");

as described in this article?

I did, to no avail. I am not sure what the URL or IP is supposed to be, I tried nearly everything I can think of - IP address, no port, mysql.server, etc.. I setup MySQL on my local machine using workbench and I am SSH tunneling but can't get this figured out.

Here is what I used:

function connect_mysql() {
  var connection = Jdbc.getConnection("jdbc:mysql://roqcap.mysql.pythonanywhere-services.com:3306/roqcap$ROQ_Trading","user","pwd");
};

where user and pwd are my details.

Hi there, our MySQL service isn't available from outside of PythonAnywhere. You could build a little rest API to query it through, perhaps?

Are there any plans to make it available? I'm trying to build an app that would greatly depend on this.

no plans as of now, no. you could use an ssh tunnel perhaps? https://help.pythonanywhere.com/pages/SSHTunnelling