Connect MySQL Data to Google Sheets: Your Ultimate Guide (2025)

Automate your database reporting for faster, easier data analysis. Learn to easily extract MySQL data to Google Sheets in under two minutes.

Mar 12, 2025

By Two minute reports

10 min read

Connecting MySQL to Google Sheets opens up a world of possibilities for data analysis, reporting, and collaboration. As businesses increasingly rely on data-driven decisions, having direct access to one of the most popular relational database management systems (MySQL) within a user-friendly platform like Google Sheets can significantly enhance productivity. 

This integration allows users to leverage the powerful querying capabilities of MySQL while benefitting from the intuitive interface and versatile functionalities of Google Sheets. Whether you're a marketer analyzing customer data, an analyst monitoring sales metrics, or anyone in between, this guide will walk you through the process of bridging your MySQL database with Google Sheets effectively.

MySQL, known for its efficiency and fast performance in the world of relational database management systems (RDBMS), is essential for effective database management. While it serves its purpose well, extracting data for analysis or reporting can often be challenging.  

A big reason behind the challenges is the whole process. Extracting data typically requires a combination of database knowledge, API understanding, and scripting skills. Here are some notable challenges you may encounter:

  1. Establishing a secure connection: Creating a secure link between MySQL and your data management tool can be complicated, especially when dealing with firewall settings.
  2. Performance issues: Handling large volumes of data can be time-consuming and may impact database performance. 
  3. Real-time synchronization: Keeping Google Sheets updated with changes from the MySQL database can be difficult.
  4. Data automation: Automated, scheduled data transfers necessitate additional scripting and configuration.

These challenges may arise across industries, be it banking, online retail, or learning management systems, all of which require effective data for insights and analytics. While hiring a professional can be one solution, there are simpler methods you can explore to extract your MySQL data in just a few minutes. In this article: 

  1. How to extract MySQL data to Google Sheets  (in under 2 minutes)
  2. How to optimize MySQL for data extraction

Before you begin the integration process, ensure you have the following prerequisites in place: 

  • Google account: You will need a Google account to access Google Sheets and utilize its functionalities. 
  • MySQL database access: Ensure you have access to a MySQL database with the necessary credentials (hostname, username, password) to connect and query the data.
  • Two Minute Reports (TMR) tool: This integration primarily uses TMR, so you'll need to install it or ensure it is configured correctly to facilitate the connection. 
  • Basic understanding of SQL: Familiarity with SQL syntax will be helpful for creating queries, although TMR simplifies much of this process. 
  • Network access: Ensure that your network settings allow connections from Google Sheets to your MySQL database, as firewall configurations might need adjustment. 

How to extract MySQL Insights to Google Sheets?

Let’s walk through effective methods to build reports in Google Sheets using MySQL data. First, install the Two Minute Reports add-on by following this step-by-step installation tutorial: How to install Two Minute Reports

Once installed, you can proceed to follow two methods:

  • Method 1: Connecting MySQL Insights to Google Sheets using the Sidebar
  • Method 2: Connecting MySQL Insights to Google Sheets using in-built templates

Step 1: Creating a Connection to your source

  • Open a new Google Sheet and launch TMR from the extensions menu. The TMR sidebar will appear on the right side. 

TMR Dropdown.png

Note: The sidebar serves as the primary interface for TMR, with all its features. 

Screenshot 2025-02-04 at 4.59.11 PM.png
  • Navigate to the menu dropdown in the TMR sidebar and click Connections. Next, click Add to create a new Connection.
  • The ‘Adding a new Connection’ dialog box appears. Here, we will perform three key steps to establish a Connection in Google Sheets, which takes less than 2 minutes:
    • Selecting the MySQL Connector 
    • Authentication 
    • Mapping your MySQL account with the respective Connector

Screenshot 2025-02-04 at 4.59.56 PM.png

  • Authorize TMR to extract data from MySQL by entering your credentials: 
    • DB host address
    • DB port
    • DB name
    • Login credentials
    • Request origin
  • Once you’ve typed in the credentials, click Test Connection to attempt a connection and validate your credentials. If successful, TMR saves your credentials for future use.
  • If you encounter an error, it's probably related to your credentials or MySQL configuration. Double-check your information and ensure that the IP is whitelisted for access.

Step 2: Whitelisting the IP Source (If error occurs)

Since TMR’s servers are hosted on Amazon Web Services, you may need to whitelist their IP addresses in your MySQL configuration.

  1. Log in to the MySQL console using this command: mysql -u userwithgrantaccess -p    
  2. Create new users for the specific IP addresses: CREATE USER 'newDbUsername'@'54.242.82.213' IDENTIFIED BY 'newDbPassword'; CREATE USER 'newDbUsername'@'3.94.252.169' IDENTIFIED BY 'newDbPassword';
  3. Assign “Read Only” access:
    GRANT SELECT ON yourDatabaseName.* TO 'newDbUsername'@'54.242.82.213'; GRANT SELECT ON yourDatabaseName.* TO 'newDbUsername'@'3.94.252.169';

With the IP addresses whitelisted, you can now use the TMR connector to pull data from your MySQL database efficiently.

Step 3: Creating a Query and report configuration

  • Once you’ve added and authorized the MySQL data source to TMR, you can create unlimited queries to fetch data. 
  • To start a query, navigate to the Data Queries section from the drop-down main menu in the top right part of the sidebar. 
Screenshot 2025-02-21 at 11.06.23 PM.png
  • Remember to name your query appropriately for future use. 
  • Then, choose the data source created from the previous steps. 
  • Next, you can enter your MySQL data query in the Query Editor below. 
    Note: For security, TMR only allows Select-based queries in the Query Editor. 
    Here’s an example: 

SELECT o.order_id,

       photo_req_id, pr.slug, p.amount, user_id, 

       o.createdAt, o.updatedAt, output_img_path, product

FROM mp2_app.orders o, 

     mp2_app.photo_requirements pr, 

     mp2_app.payments p

WHERE pr.id = photo_req_id 

  AND p.order_id = o.order_id 

  AND o.createdAt >= DATE(NOW()) - INTERVAL 7 DAY;

  • When ready, click “Run Query” from the bottom to execute the query. This will fetch all data from your MySQL database and send it to Google Spreadsheets. You can modify or run this query again from the data query section.

Note: Unlike data sources, MySQL data queries are stored in your Google Sheets locally. This means that the queries can be accessed only from within the sheet in which you created. This step is taken to manage multiple queries within the tool.

Adding cell references in MySQL (Optional)

Every time you run a query, you might have to tweak it regularly using the query editor— even if it’s a simple change to the date in the WHERE clause. Manually changing the SQL query for every iteration could be time-consuming. 

TMR, a tool to reduce the time taken to create reports, has a solution. You can use cell references in your SQL query to dynamically update them based on cell values from your spreadsheet. 

  • Connect your data source and set up your data query as you did in the previous method. 
  • Let’s say you have a SQL query pulling data from a table with a filter condition on the date column (e.g., created_at > ‘2023-10-01’). Here’s what your SQL Query could look like: 

SELECT id, name, created_at, updated_at 

FROM orders 

WHERE created_at >= '2023-10-01';

  • Instead of manually specifying the date in the query, you can type the desired date in any cell and reference that cell in your SQL query. 
    A cell reference must be in the format of “+++SHEET_NAME!CELL+++”. If your sheet’s name has spaces (like Orders Report), make sure to enclose them within single quotations (‘). 

Note: Since this is a dynamic query, it is enclosed by “+++” on both sides.

  • With the cell reference query, your SQL request must look like: 

SELECT id, name, created_at, updated_at, status

FROM orders

WHERE created_at > +++Order Report!B1+++

With this code, TMR will fetch the data for the date from cell “B1” in the “Orders Report” sheet and substitute the data from the SQL query from that date. 

Note: With a cell reference query, you cannot specify a range of cells, such as “+++’Orders Report’!A2:A5+++”.

By using this feature, you can dynamically adjust values in your SQL query, fetching specific rows with an “active” status or changing the sorting column from “created_at” to “updated_at”.

Read more about using cell references in MySQL queries in this guide.

Scheduling data refresh and emails 

At this point, you’ve successfully:

  • Installed TMR
  • Created a MySQL Connection in TMR
  • Authorized your Connection
  • Created a query to fetch your data

Now, you can run your query whenever needed or automate it!

With the Schedule Refresh feature, TMR can automatically refresh your queries according to your preferred schedule—weekly, daily, or even hourly. You can also receive updates via email. 

  • Click on the menu and select Schedule Refresh to open the section.
  • Create a schedule by naming it and selecting the refresh interval (daily, weekly, or monthly).
  • Designate the refresh days and times that best suit your needs.
  • Choose the action for each data refresh—decide if you want email notifications.
  • Select the relevant sheet for the refresh and enter your email for notifications, if desired.
  • Save the refresh settings, ensuring TMR will refresh your data at the specified intervals.
  • Choose the Action for every data refresh— whether you need an email notification for every refresh. 
  • Then, choose the relevant sheet for the refresh, and type in your email (in case you need an email notification).
  • Save the refresh and ensure that TMR will refresh your data at the desired intervals.
  • Click on the menu and then on Schedule Reports to open the section. From this section, you can create a “Schedule,” an instruction for TMR to run the query automatically. 
  • Name the Schedule and choose the time interval between the data refreshes. From this section, you can choose the following: 
    • You want your data daily, weekly, or monthly.
    • The designated day for the refresh
    • The time for the refresh
       
Screenshot 2024-09-19 at 12.36.15 PM.png
  • Choose the Action for every data refresh— whether you need an email notification for every refresh. 
  • Then choose the relevant sheet for the refresh, and type in your email (in case you need an email notification)
  • Save the refresh and ensure that TMR will refresh your data at the desired intervals. 

Use our quick templates for Google Sheets

1. Facebook Ads Campaign Performance Dashboard

Facebook Ads Campaign Performance Dashboard
View Template
Facebook Ads Campaign Performance Dashboard

This is an amazing template for the modern audience, to get an overview of their campaign performance for Facebook Ads. This template contains line charts to view Impressions, Reach, Clicks and CPC, scorecard charts to give an overview, and a comparison table to view the Amount Spent, Impressions, Clicks, CPC and CTR on different campaigns. All these metrics can be controlled using the date filter at the top. Click on preview to get to know more about the template.

2. Facebook Ads vs Google Ads vs LinkedIn Ads Dashboard

Facebook Ads vs Google Ads vs LinkedIn Ads Dashboard
View Template
Facebook Ads vs Google Ads vs LinkedIn Ads Dashboard

This is a multi data source dashboard, which gets all the main KPI's of Facebook Ads, Google Ads and LinkedIn Ads. You get a collection of scorecards like Amount Spent, Impressions, CPM, Clicks and CPC for all 3 data sources. A dedicated table chart which compares Cost and Impressions of all 3 data sources. You get a Cost, Impressions and Clicks table and a geo chart for clicks over the world. Do check out the template to get a better perspective of it.

Why import MySQL data in Google Sheets?

Importing MySQL data to Google Sheets is like a one-two punch of simplicity and sophistication. From data management to complex formulae, a Google spreadsheet could be the most intuitive platform for any marketer or analyst to work with. 

Below are reasons why this integration works like a charm. 

Centralized data access: Google Sheets removes the complexity of working with MySQL databases, by bringing it into a familiar, spreadsheet-based environment. This makes raw data easily accessible for analysis and collaboration without requiring SQL knowledge or code. 

Flexible data manipulation: Google Sheets offers multiple ways to modify your data— from quick calculations to minute formatting details. The intuitive formulae and the formatting tool make reporting easy, and adaptable. 

Integration with Google ecosystem: Google Sheets also offers seamless integration to Google Drive, Analytics, and BigQuery to help create streamlined data analysis. These tools also enrich data analytics with their robust features. 

Real-time collaboration: Collaboration in Google Sheets is real-time. Multiple users can edit and comment on the same document simultaneously, sharing insights and working together easily. You can also share it with clients, and set limits to your access as you need. 

Enhanced accessibility: As a cloud-based tool, Google Sheets ensures that your MySQL data is accessible anytime, anywhere. Its compatibility with mobile devices and offline mode adds further convenience, especially for remote teams.

Why Two Minute Reports (TMR)?

  1. Centralized data integration: TMR is a Google Sheets add-on that consolidates your metrics from various platforms, including top advertising sources and analytics tools. It eliminates the need for manual CSV imports, creating a seamless data flow from MySQL to Google Sheets.
  2. Extensive integrations and upcoming features: TMR’s Google Sheets add-on currently supports integrations with a wide range of platforms across advertising, analytics, SEO, social media, e-commerce, email, mobile, CRM, and databases. This includes Facebook, MySQL, LinkedIn, and many more, with exciting upcoming integrations to enhance its capability.
  3. Intuitive reporting: All the reports that the TMR add-on helps to create are professional, and mobile-friendly. The intuitive interface enables you to craft and customize reports, and share them with an unlimited number of users.
  4. Cost-effective and user-friendly: TMR is a user-friendly add-on, doesn’t have a steep learning curve, and is priced affordably — without sacrificing functionality.
  5. Native Connectors and API Bridge: Native connectors simplify pulling data from various sources. The API Bridge feature allows connection to any data source that returns JSON, making data accessibility limitless in Google Sheets.
  6. Efficiency and customization: TMR’s add-on helps you set up dashboards swiftly with pre-built templates that can be customized and duplicated. With templates, you can now streamline report generation and client setup.
  7. Automatic data refreshes and reports: TMR enables you to schedule data to refresh automatically in Google Sheets and send beautifully formatted reports via email, saving time and keeping clients informed with the latest data.

Two Minute Reports is not just about data consolidation but also about empowering businesses. With TMR’s AI-powered report creation and report configuration tools, your business can now automate and streamline reporting processes, making data-driven decisions quicker and more efficient. 

 

 

Security considerations for your MySQL account

When connecting MySQL to Google Sheets, it's essential to prioritize security to protect sensitive data: 

  1. Use secure connections: Ensure that your MySQL connection uses SSL/TLS encryption to protect data in transit. Check with your database administrator to enable secure connections. 
  2. Limit user permissions: Grant the least privileges necessary to users accessing the MySQL database through Google Sheets. Avoid using administrative accounts for queries. 
  3. Regularly update credentials: Change database credentials periodically and ensure to manage access controls to mitigate potential security risks. 
  4. Monitor access logs: Regularly review server access logs for unusual activity that may indicate unauthorized access attempts. 
  5. Data validation: Implement data validation rules in Google Sheets to prevent erroneous or malicious entries, especially when using cell references that interact with your SQL queries. 

By adhering to these security measures, you can maintain data integrity and protect sensitive information while leveraging the benefits of data integration. 

How to optimize your MySQL database for efficient data exports?

TMR’s MySQL connector simplifies data extraction from MySQL databases with optimization. As a core ETL tool, TMR handles optimization of stored procedures, partitioning, caching, or compression. However, there are a few measures that you can take to make the process more efficient. 

  • Indexing: Proper indexing of your MySQL database will always improve query performance.
  • Data types: Using appropriate data types in your MySQL tables will help with both storage and query efficiency.
  • Query optimization: While TMR may handle some query optimization, writing efficient SQL queries will still benefit your data extraction process.
  • Regular maintenance: Keeping your MySQL database well-maintained will improve overall performance.
  • Archiving: Having an archiving strategy can still be beneficial for managing large datasets.

Integrating MySQL with Google Sheets streamlines the process of accessing and analyzing data, making it easier for users to derive insights without extensive technical expertise. With the ability to create dynamic queries, automate data refreshes, and apply advanced querying techniques, you can transform raw data into actionable business intelligence.

By following the outlined steps and considering security best practices, you'll be well-equipped to harness the full potential of this powerful integration. Now is the time to implement these strategies and enhance your data management capabilities, driving better decision-making in your organization.

Get MySQL data in Looker Studio

TMR can be installed as an add-on to integrate MySQL data with Looker Studio (formerly Google Data Studio) as well, enabling advanced data analysis and visualization. 

This MySQL add-on allows the creation of detailed reports and dashboards using insights from MySQL insights without the complexity of manual data entry. Looker Studio’s customization capabilities also let users craft custom formulae in a user-friendly interface. 

With seamless integration, comprehensive analytical capabilities, and automated workflows, strategic business intelligence from MySQL has become quicker and more accessible. 

Connect other platform data sources with Google Sheets

With this add-on, you can connect 30+ data sources to Google Sheets, create additional reports, create visualizations, and build a comprehensive report. 

Increase your Client's ROI by 2x
Reports done in two minutes
ctaStart your Free trial now

Frequently Asked Questions

Can I connect MySQL to Google Sheets?

Yes, you can connect MySQL to Google Sheets. There are several methods to achieve this, including using third-party connectors, Google Apps Script, or add-ons available in the Google Workspace marketplace like Two Minute Reports.

How do I export MySQL tables to Google Sheets?

Here are a few ways to export MySQL tables to Google Sheets:

  1. CSV export: Use `SELECT INTO OUTFILE` or a MySQL client to export data as CSV, then upload to Google Sheets via "File" > "Import".

  2. Google Apps Script: Write a script to connect to your MySQL database and fetch data into Sheets.

  3. Third-party tools: Utilize tools like Two Minute Reports for automated data transfer.

  4. Database connectors: Use connectors for Google Data Studio to link MySQL for live reporting.

  5. Google Cloud SQL: If using Google Cloud, use built-in integrations to export data directly to Sheets.

How to automate data extraction from MySQL to Google Sheets?

With TMR, you can create MySQL queries and schedule them to refresh automatically. With this feature, you can receive weekly, daily, or even hourly updates, with a copy sent to your email. 

How to optimize MySQL for data extraction?

Some common steps to optimize MySQL are: 

  1. Ensure proper indexing
  2. Use appropriate data types
  3. Write optimized SQL queries
  4. Regular Maintenance
  5. Archiving
     

Does it require coding to extract data from MySQL?

Running MySQL queries typically requires coding. But with TMR, most aspects, like converting data, transformation, and automation require absolutely no code. 

What is MySQL?

MySQL is a popular open-source Relational Database Management System (RDBMS). This system helps you create databases that store data with pre-defined relationships with other data. 

What is a data source?

Data source is where you get your data for analysis, comparison, and decision-making. It could be a website, application, or a digital tool.