Automate MySQL to Google Sheets Sync with n8n
detail.loadingPreview
Effortlessly synchronize your MySQL database records to a Google Sheet in real-time. This workflow ensures your data is always up-to-date across platforms, eliminating manual data entry and potential errors.
About This Workflow
This n8n workflow automates the process of transferring data from your MySQL database to a Google Sheet. It's designed to fetch specific rows from a designated MySQL table, specifically those marked as not yet synced, and append them as new rows in your chosen Google Sheet. To prevent duplicate entries in subsequent runs, the workflow then updates the 'sync' status of the transferred records in your MySQL table to indicate they have been processed. This ensures a clean and efficient data synchronization process, saving you valuable time and effort.
Key Features
- Automated Data Transfer: Seamlessly move data from MySQL to Google Sheets without manual intervention.
- Selective Syncing: Only syncs records marked as 'not synced' (sync = 0) in your MySQL table.
- Duplicate Prevention: Updates records to 'synced' (sync = 1) after transfer to avoid duplication.
- Real-time Updates: Schedule the workflow to run at regular intervals (e.g., every 15 minutes) for near real-time data synchronization.
- Customizable Fields: Easily map and transfer specific columns from your MySQL table to your Google Sheet.
How To Use
- Connect MySQL: Configure the 'Select rows from a table' node with your MySQL database credentials and specify the table name (
fifa25_customers). Set thewhereclause tosync = 0to fetch unsynced records. - Connect Google Sheets: Configure the 'Append row in sheet' node with your Google Sheets credentials. Select your target Google Sheet and specify the sheet name or ID. Map the desired columns from your MySQL data to the Google Sheet columns using expressions (e.g.,
={{ $json.id }}). - Update MySQL Sync Status: Configure the 'Update rows in a table' node with your MySQL credentials. Specify the table name (
fifa25_customers). Set thevaluesToSendtosync = 1and use theidcolumn to match and update the records that were just synced. - Set Schedule Trigger: Configure the 'Schedule Trigger Every n Mins' node to define how often you want the workflow to run (e.g., every 15 minutes).
- Conditional Execution: Use the 'IF' node to ensure that the Google Sheets append and MySQL update operations only run if new records were actually retrieved from the MySQL database.
Apps Used
Workflow JSON
{
"id": "a655246a-e215-4bda-9f33-f21676495543",
"name": "Automate MySQL to Google Sheets Sync with n8n",
"nodes": 13,
"category": "Operations",
"status": "active",
"version": "1.0.0"
}Note: This is a sample preview. The full workflow JSON contains node configurations, credentials placeholders, and execution logic.
Get This Workflow
ID: a655246a-e215...
About the Author
DevOps_Master_X
Infrastructure Expert
Specializing in CI/CD pipelines, Docker, and Kubernetes automations.
Statistics
Related Workflows
Discover more workflows you might like
Universal CSV to JSON API Converter
Effortlessly transform CSV data into structured JSON with this versatile n8n workflow. Integrate it into any application as a custom API endpoint, supporting various input methods including file uploads and raw text.
Instant WooCommerce Order Notifications via Telegram
When a new order is placed on your WooCommerce store, instantly receive detailed notifications directly to your Telegram chat. Stay on top of your e-commerce operations with real-time alerts, including order specifics and a direct link to view the order.
On-Demand Microsoft SQL Query Execution
This workflow allows you to manually trigger and execute any SQL query against your Microsoft SQL Server database. Perfect for ad-hoc data lookups, administrative tasks, or quick tests, giving you direct control over your database operations.