Pricing

How to Connect MySQL to Google Sheets

Also available in: Español

JDBC URLjdbc:mysql://HOST:3306/DATABASE ?useSSL=true&characterEncoding=UTF-8Apps Script · JDBCconst conn = Jdbc.getConnection(url, user, pass);const rs = conn.createStatement() .executeQuery("SELECT * FROM orders");sheet.appendRow(row); // → Google Sheets5,280rows importedsynced
JW
James Whitfield

Apps Script with JDBC, CSV exports, IMPORTDATA, and no-code add-ons compared — with the exact cloud-provider connection strings (RDS, PlanetScale, Cloud SQL, Azure), scheduled refresh, two-way write-back, and an AI agent that writes the SQL for you.

MySQL powers a huge slice of production software — e-commerce backends, SaaS apps, internal tools — and yet, somewhat famously, Google Sheets has no first-party MySQL connector. So every team that wants live MySQL data in a spreadsheet ends up picking from the same four options: a Google Apps Script with JDBC, a CSV export from the CLI, an IMPORTDATA hack against a public API, or a third-party add-on.

This guide walks through all four, with the trade-offs that actually matter — execution time limits, refresh semantics, two-way write-back, cost — so you can pick the right one for your situation. The short version: CSV for one-offs, Apps Script for one-developer custom workflows, Brooked for everything else. The longer version is below.

Quick comparison: 4 ways to get MySQL into Google Sheets

MethodCostSetupAuto-refreshTwo-way syncCodeBest for
Google Apps Script (JDBC)Free30–60 minManual or time-triggerDIYRequiredOne-off pulls, devs comfortable with scripts
CSV export from MySQLFree5 min per pullManualNoOptional (CLI)One-time transfers, ad-hoc analysis
IMPORTDATA via a public APIFree + infraHours to daysSheet-formulaNoRequired (build the API)Teams that already expose MySQL via REST
Brooked add-onFree tier · Pro $29/userUnder 5 min15 min / hourly / dailyYes (INSERT/UPDATE/UPSERT/DELETE)NoneTeams who want it to keep working

Method 1 — Google Apps Script with JDBC

Google Apps Script ships with a built-in Jdbc service that can connect to MySQL directly. This is the free, code-first approach — it's the right call if you're comfortable writing a small script, you only need a handful of pulls, and you're OK maintaining the connection details yourself.

Open your Google Sheet, click Extensions → Apps Script, paste the following, and replace the placeholder values with your own:

Apps Script
function importMySQLToSheet() {
  const url = 'jdbc:mysql://HOST:3306/DATABASE?useUnicode=true&characterEncoding=UTF-8&useSSL=true';
  const conn = Jdbc.getConnection(url, 'USERNAME', 'PASSWORD');
  const stmt = conn.createStatement();
  const rs = stmt.executeQuery('SELECT id, name, revenue FROM orders WHERE created_at > NOW() - INTERVAL 30 DAY');

  const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
  sheet.clearContents();

  // Header row
  const meta = rs.getMetaData();
  const cols = meta.getColumnCount();
  const headers = [];
  for (let c = 1; c <= cols; c++) headers.push(meta.getColumnName(c));
  sheet.appendRow(headers);

  // Data rows
  while (rs.next()) {
    const row = [];
    for (let c = 1; c <= cols; c++) row.push(rs.getString(c));
    sheet.appendRow(row);
  }

  rs.close();
  stmt.close();
  conn.close();
}

Save, then click Run. Google will prompt for permissions the first time. To make it recurring, add a time-driven trigger from the Apps Script menu (Triggers → Add trigger → Time-based → choose hourly/daily).

Pros: Free. Fully customisable. Lives inside your own Google account — no third-party service in the loop.

Cons: The script kills itself at 6 minutes of execution, which is a problem for any query that scans real data volumes. Your MySQL instance has to allow inbound traffic from the Google Apps Script IP ranges (which change). Credentials sit in plain text in the script unless you move them into Script Properties. And you maintain it forever — schema changes break it silently.

Method 2 — CSV export from MySQL

The lowest-friction approach for a one-off pull. If you just need a snapshot of some data right now and you're never going to look at it again, this is fine and you should not over-engineer it.

From the command line:

Shell
mysql -h HOST -u USER -p DATABASE -e \
  "SELECT id, name, revenue FROM orders WHERE created_at > NOW() - INTERVAL 30 DAY" \
  --batch --raw \
  | sed 's/\t/,/g' > orders.csv

Or from MySQL Workbench: run the query, click the Export icon above the results pane, pick CSV. Then in Google Sheets, click File → Import → Upload and choose the file.

Pros: Zero infrastructure. Zero recurring cost. Works for any one-off ask.

Cons: No automation. The data is a snapshot — it's stale the moment it lands in the sheet. Manually re-exporting every day is exactly the pain Brooked, Supermetrics, and Coefficient exist to solve.

Method 3 — IMPORTDATA against a public MySQL endpoint

Google Sheets ships with IMPORTDATA(url) and IMPORTHTML(url) formulas that can pull data from a public URL into a sheet. This can work for MySQL — but only if you first build a small public HTTP wrapper (a REST API, a static export endpoint) that returns CSV.

Realistically, almost no team should reach for this. If you already have a stable internal API on top of MySQL, you're going to want a connector that authenticates properly anyway. If you don't, you're about to build infrastructure to dodge installing an add-on. We mention it only because it does come up in answers to this query and most of them gloss over the catch.

Method 4 — A Google Sheets add-on (Brooked, Coefficient, Supermetrics)

If MySQL data needs to live in Sheets on an ongoing basis — across a team, on a schedule, with someone who isn't going to maintain a script — an add-on is the answer. There are three credible options in 2026: Coefficient (premium tier from $83/user/month annual), Supermetrics (database connector from $159/month), and Brooked ($29/user/month, with MySQL on every tier including Free).

We're going to walk through Brooked because (a) it's what we make, and (b) it's the only option that ships two-way write-back and a native AI agent on every database connector without a price-tier gate. If you're evaluating, the Brooked vs Coefficient and Brooked vs Supermetrics pages have full side-by-side comparisons.

Supported MySQL hosts (Brooked)

  • Amazon RDS for MySQL and Aurora MySQL
  • PlanetScale (via the MySQL protocol)
  • Google Cloud SQL for MySQL
  • Azure Database for MySQL
  • Railway, Render, Fly.io managed MySQL
  • Self-hosted MySQL 5.7+ and 8.0+ (including caching_sha2_password)

Step 1 — Install Brooked

Install Brooked from the Google Workspace Marketplace. The free tier includes 100 imports per month with AI Analyst — no credit card required, and your team's Google Workspace admin can approve it without a procurement loop.

Step 2 — Connect your MySQL database

Open the Brooked sidebar and click Add data source → MySQL. Enter:

  • Host — your database hostname or IP address
  • Port — default 3306
  • Database name
  • Username and password
  • SSL mode — required for most cloud-hosted databases (RDS, PlanetScale, Cloud SQL, Azure)

Credentials are encrypted at rest, never logged, and never sent to any third party. For a clean security posture, create a dedicated brooked_reader MySQL user with SELECT-only privileges on the schemas you want to expose to Sheets. If you need two-way sync, create a second user with INSERT, UPDATE, and DELETE privileges scoped to the specific tables you want to write back to.

Step 3 — Import data into the sheet

Click New import, pick your MySQL connection, and either select a table or write a custom SQL query. Pick the destination range (anywhere in any sheet — Brooked doesn't take over the tab) and click Import. Toggle Auto-refresh to keep it in sync on a 15-minute, hourly, daily, or weekly schedule.

Two-way sync — writing data back to MySQL

This is the capability that doesn't really exist in CSV exports, Apps Script (without a lot of work), or most other Sheets connectors. Brooked lets you select a sheet range, pick a target MySQL table, and choose the write mode: INSERT, UPDATE, UPSERT (which compiles to INSERT … ON DUPLICATE KEY UPDATE), or DELETE.

Common pattern: the ops team manages a list of records in Sheets (vendor approvals, manual product overrides, support ticket triage), and Brooked syncs those changes back into the application database without anyone touching the admin tool. Every write is captured in an audit log with the row diff, the user, and the timestamp.

Using the AI agent with MySQL

Open the Chat tab and ask questions about your MySQL data in plain English. The agent introspects your schema, writes the SQL, runs it against your database, and lands the result in the sheet. You can also tell it to run Python — pandas and numpy are pre-loaded — for follow-up analysis the SQL layer can't easily do (rolling cohorts, time-windowed aggregates, statistical tests).

BrookedBrooked AI — MySQL
Live
Ask anything about your MySQL data…

The verdict — which method when

  • I just need this data once, today

    CSV export from MySQL. 30 seconds in mysqldump or Workbench, paste into Sheets. Don't overthink it.

  • I want a custom pull and I'm comfortable with code

    Google Apps Script (JDBC). Full control, zero cost, but you'll maintain the script forever and dodge the 6-minute execution limit.

  • My team needs live MySQL data in Sheets every day

    Brooked (or another add-on). Scheduled refresh, no script maintenance, OAuth-style credential storage, audit trail.

  • I need to edit data in Sheets and push back to MySQL

    Brooked. Two-way write-back (INSERT, UPDATE, UPSERT, DELETE) is a feature most other Sheets connectors don't ship.

  • I want to ask the database questions in plain English

    Brooked. The AI agent writes the SQL, runs it against your MySQL, and lands the result in the sheet. Python sandbox attached for follow-up analysis.

Common MySQL → Sheets use cases

  • E-commerce reporting — pull orders, revenue, and product data into live dashboards for ops and finance
  • SaaS analytics — sync user signups, feature usage, and churn metrics on a schedule for the weekly business review
  • Inventory and supply-chain management — sync product, stock, and supplier records into Sheets for ops review (and write decisions back)
  • Sales and CRM data — pull customer and contact records from the application DB into sheets for sales-team analysis
  • Ad-hoc product analysis — run one-off SQL against MySQL and share results with non-SQL stakeholders without exporting CSVs

Troubleshooting common issues

How to schedule automatic MySQL refreshes in Google Sheets

There are two realistic ways to keep MySQL data refreshing on a schedule. The Apps Script route uses the built-in JDBC service with a time-driven trigger — workable, but you maintain the code, and Apps Script caps every execution at six minutes, so large result sets time out and you end up paginating by hand. The no-code route hands the scheduling to a connector instead.

With Brooked, open the import, choose every 15 minutes, hourly, daily, or weekly, and the MySQL query re-runs on that cadence and writes the fresh rows back into the same range — no trigger script to maintain and no six-minute ceiling. It behaves the same for Amazon RDS, PlanetScale, Google Cloud SQL, and Azure Database for MySQL.

Running more than one database? The same scheduled-refresh setup covers PostgreSQL and SQL Server.

Frequently asked questions

What's the fastest way to get MySQL data into Google Sheets?

For a one-time pull: export to CSV from MySQL Workbench or the CLI and import in Sheets. For anything recurring: install a connector add-on like Brooked from the Google Workspace Marketplace, paste your MySQL credentials, and you're querying live data in about 3 minutes.

Is there a free way to connect MySQL to Google Sheets?

Yes. Google Apps Script (with JDBC) is fully free and unlimited if you're willing to write and maintain the script. Brooked's free tier also covers 100 imports per month with AI Analyst included, no credit card. Both work indefinitely for small workloads.

Does Google Sheets have a built-in MySQL connector?

No. Google Sheets has no first-party MySQL connector. You need either Apps Script with JDBC (code), CSV export (manual), or a third-party add-on (Brooked, Coefficient, Supermetrics).

Can I run live SQL queries against MySQL from Google Sheets?

Yes. With Brooked you write SQL in a sidebar editor, pick a destination range, and run it. With Apps Script you write the query inside the script. With CSV export you can't — the data is a snapshot, not a live query.

How do I sync MySQL to Google Sheets automatically?

On Brooked Pro: schedule any import to refresh every 15 minutes, hourly, daily, or weekly. On Apps Script: build a time-driven trigger that re-runs your script. CSV export has no automation path short of writing your own pipeline.

Can I write data from Google Sheets back to MySQL?

With Brooked: yes — INSERT, UPDATE, UPSERT (INSERT … ON DUPLICATE KEY UPDATE), and DELETE are all supported with a configurable target table and key mapping. With Apps Script: technically yes if you wire it up, but you're writing the connector. Most other Sheets connectors are read-only.

Does Brooked work with PlanetScale, Amazon RDS, and Azure Database for MySQL?

Yes. Brooked supports any MySQL-protocol endpoint — Amazon RDS MySQL and Aurora MySQL, PlanetScale, Google Cloud SQL for MySQL, Azure Database for MySQL, Railway, Render, and self-hosted MySQL 5.7+ / 8.0+.

What about Coefficient or Supermetrics for MySQL?

Coefficient supports MySQL on its Pro plan ($99/user/month, ~$83 billed annually). Supermetrics covers MySQL via its Database connector from €199/month (€159 billed annually). Brooked Pro is $29/user/month with MySQL on every tier — see the Brooked vs Coefficient and Brooked vs Supermetrics comparisons for full breakdowns.

How do I schedule a MySQL query to refresh in Google Sheets automatically?

On Brooked Pro, open the import, set the schedule to every 15 minutes, hourly, daily, or weekly, and the MySQL data refreshes in your sheet on its own — no Apps Script trigger, no manual re-run. Most teams put operational dashboards on hourly and finance models on daily.

Ready to skip the script and the CSV exports?

Brooked's free tier covers 100 imports per month with AI Analyst included — no credit card. Or see the full MySQL integration details.

Install Brooked free →

Also in Database

More Database guides

Database

How to Connect PostgreSQL to Google Sheets

The exact working JDBC string for Apps Script, psql/COPY exports, postgres_fdw federation, and no-code add-ons — plus the cloud-provider gotchas (RDS, Supabase, Neon, Cloud SQL), Google IP allowlisting, both directions, and an AI agent that writes the SQL.

JW
James Whitfield
Read
Database

How to Connect SQL Server to Google Sheets

Import SQL Server query results into Google Sheets, schedule auto-refresh, and write data back — works with Azure SQL, Amazon RDS SQL Server, and self-hosted instances.

JW
James Whitfield
Read
Database

How to Connect Supabase to Google Sheets

Import Supabase query results into Google Sheets, schedule auto-refresh, and write data back — connect directly using your project's Postgres connection string.

JW
James Whitfield
Read

Get your spreadsheet hours back

Brooked sets up in seconds. Your team is querying live data before lunch.

Get started free