Web Applications Stack Exchange is a question and answer site for power users of web applications. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have been wondering about this for a while. We are using those google spreadsheet a lot with my colleagues and the thing is that we always have to write down data that we already have in our MySQL database.

I wonder if there is a possibility to connect your spreadsheet with MySQL server and fetch the data to specific rows via executable script or something.

share|improve this question

migrated from superuser.com Apr 10 '13 at 22:19

This question came from our site for computer enthusiasts and power users.

You can use the JDBC services of Google Apps Scripts.

You will have to write a script that populates your spreadsheet with data from the JDBC service.

Not sure exactly what you want to do, but you could start with the example from the documentation:

function foo() {
  var conn = Jdbc.getConnection('jdbc:mysql://<host>:3306/<instance>', 'user', 'password');
  var stmt = conn.createStatement();
  var start = new Date();
  var rs = stmt.executeQuery('select * from person');

  var doc = SpreadsheetApp.getActiveSpreadsheet();
  var cell = doc.getRange('a1');
  var row = 0;
  while (rs.next()) {
    for (var col = 0; col < rs.getMetaData().getColumnCount(); col++) {
      cell.offset(row, col).setValue(rs.getString(col + 1));
  var end = new Date();
  Logger.log('Time elapsed: ' + (end.getTime() - start.getTime()));
share|improve this answer
select * from table_name
into outfile '/somelocation/data.csv'

Launch google spreadsheet. Open the data.csv file Your data is imported for use in Google.

Or do you want a real time connection?

share|improve this answer
Well real time connection would be better, but I am not sure if it is possible. – Jan Alfréd Richter Apr 10 '13 at 8:53
I have not done it with google docs, but I have done it with google calendar. If you run a webserver with php it might be possible. Download the API get the developer ID from google and a bunch of other stuff. – cybernard Apr 10 '13 at 21:40

Zapier.com now has a mysql to Google Sheets zap. Simple to set up and all automated. It's a premium service, so it will set you back $15/mo.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.