Sign up ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

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 Apr 10 '13 at 22:19

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

3 Answers 3

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 ( {
    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 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.