Back to Catalog

Automated MySQL to Google Sheets sync with duplicate prevention

Ahmed SaadawiAhmed Saadawi
700 views
2/3/2026
Official Page

📝 Sync MySQL Rows to Google Sheet

Description:

This n8n template automates the process of syncing new records from a MySQL database table into a Google Sheet, ideal for reporting, backup, or lightweight dashboards.

It is designed for teams or individuals who need to periodically export new data rows from a custom database (e.g., CRM, registrations, surveys) into a structured Google Sheet for further analysis, sharing, or archiving—without duplicates.


🛠️ What This Workflow Does:

  • Runs every 15 minutes via a schedule trigger.
  • Selects unsynced rows (sync = 0) from a MySQL table (fifa25_customers).
  • Checks if records exist to prevent unnecessary writes.
  • Appends records to a Google Sheet, mapping fields like name, email, phone, gender, and more.
  • Updates the MySQL table to mark those rows as synced (sync = 1) to avoid reprocessing.
  • Fully annotated using sticky notes for easier understanding and onboarding.

📋 Setup Instructions:

  1. Create or select a Google Sheet and make sure the columns match the following:

    • id, name, phone, birthdate, email, region, gender, datatime
  2. Ensure your MySQL table (fifa25_customers) has a sync column (default = 0 for new rows).

  3. Connect your MySQL and Google Sheets credentials inside n8n.

  4. (Optional): Add custom filtering or column transformations as needed.


👤 Who Is It For?

  • Marketers syncing leads to a spreadsheet
  • Ops teams pulling user data from internal tools
  • Analysts logging form submissions or customer data
  • Anyone needing lightweight scheduled ETL from MySQL to Sheets

🔐 Credentials Required:

  • MySQL
  • Google Sheets OAuth2

Best Practices Followed:

  • Uses IF node to prevent unnecessary processing
  • Updates source database to avoid duplicates
  • Includes sticky notes for clarity
  • All columns are explicitly mapped
  • Works out-of-the-box on any n8n instance with proper creds

Automated MySQL to Google Sheets Sync with Duplicate Prevention

This n8n workflow automates the process of syncing data from a MySQL database to a Google Sheet, with built-in logic to prevent duplicate entries. It's designed to ensure your Google Sheet always reflects the latest unique data from your MySQL source.

What it does

  1. Triggers on a Schedule: The workflow starts automatically at predefined intervals.
  2. Fetches Data from MySQL: It connects to your MySQL database and retrieves records.
  3. Checks for Duplicates in Google Sheets: For each record fetched from MySQL, it queries the specified Google Sheet to see if an identical record already exists.
  4. Conditionally Adds New Records:
    • If a record from MySQL is not found in the Google Sheet, it proceeds to add that record.
    • If a record is found (a duplicate), it skips adding it to prevent redundancy.
  5. Adds New Rows to Google Sheets: New, unique records are appended as new rows to your designated Google Sheet.

Prerequisites/Requirements

  • n8n Instance: A running n8n instance to host and execute the workflow.
  • MySQL Database: Access to a MySQL database with the data you wish to sync.
  • Google Account: A Google account with access to Google Sheets.
  • Google Sheets Credential: An n8n Google Sheets credential configured with access to your target spreadsheet.
  • MySQL Credential: An n8n MySQL credential configured with access to your database.

Setup/Usage

  1. Import the Workflow: Import the provided JSON into your n8n instance.
  2. Configure Credentials:
    • MySQL Node: Set up your MySQL credential. You will need to specify your database host, port, user, password, and database name. Configure the SQL query to fetch the desired data.
    • Google Sheets Node: Set up your Google Sheets credential. You will need to specify the Spreadsheet ID and Sheet Name where the data should be synced.
  3. Configure Schedule Trigger: Adjust the "Schedule Trigger" node to your desired frequency for syncing data (e.g., every hour, daily).
  4. Configure If Node: The "If" node is crucial for duplicate prevention. You will need to configure its conditions to compare a unique identifier (or a combination of fields) from your MySQL data with existing rows in your Google Sheet. For example, if your MySQL data has an id column, you would check if that id already exists in the Google Sheet.
  5. Activate the Workflow: Once configured, activate the workflow to start the automated sync process.

Related Templates

Track competitor SEO keywords with Decodo + GPT-4.1-mini + Google Sheets

This workflow automates competitor keyword research using OpenAI LLM and Decodo for intelligent web scraping. Who this is for SEO specialists, content strategists, and growth marketers who want to automate keyword research and competitive intelligence. Marketing analysts managing multiple clients or websites who need consistent SEO tracking without manual data pulls. Agencies or automation engineers using Google Sheets as an SEO data dashboard for keyword monitoring and reporting. What problem this workflow solves Tracking competitor keywords manually is slow and inconsistent. Most SEO tools provide limited API access or lack contextual keyword analysis. This workflow solves that by: Automatically scraping any competitor’s webpage with Decodo. Using OpenAI GPT-4.1-mini to interpret keyword intent, density, and semantic focus. Storing structured keyword insights directly in Google Sheets for ongoing tracking and trend analysis. What this workflow does Trigger — Manually start the workflow or schedule it to run periodically. Input Setup — Define the website URL and target country (e.g., https://dev.to, france). Data Scraping (Decodo) — Fetch competitor web content and metadata. Keyword Analysis (OpenAI GPT-4.1-mini) Extract primary and secondary keywords. Identify focus topics and semantic entities. Generate a keyword density summary and SEO strength score. Recommend optimization and internal linking opportunities. Data Structuring — Clean and convert GPT output into JSON format. Data Storage (Google Sheets) — Append structured keyword data to a Google Sheet for long-term tracking. Setup Prerequisites If you are new to Decode, please signup on this link visit.decodo.com n8n account with workflow editor access Decodo API credentials OpenAI API key Google Sheets account connected via OAuth2 Make sure to install the Decodo Community node. Create a Google Sheet Add columns for: primarykeywords, seostrengthscore, keyworddensity_summary, etc. Share with your n8n Google account. Connect Credentials Add credentials for: Decodo API credentials - You need to register, login and obtain the Basic Authentication Token via Decodo Dashboard OpenAI API (for GPT-4o-mini) Google Sheets OAuth2 Configure Input Fields Edit the “Set Input Fields” node to set your target site and region. Run the Workflow Click Execute Workflow in n8n. View structured results in your connected Google Sheet. How to customize this workflow Track Multiple Competitors → Use a Google Sheet or CSV list of URLs; loop through them using the Split In Batches node. Add Language Detection → Add a Gemini or GPT node before keyword analysis to detect content language and adjust prompts. Enhance the SEO Report → Expand the GPT prompt to include backlink insights, metadata optimization, or readability checks. Integrate Visualization → Connect your Google Sheet to Looker Studio for SEO performance dashboards. Schedule Auto-Runs → Use the Cron Node to run weekly or monthly for competitor keyword refreshes. Summary This workflow automates competitor keyword research using: Decodo for intelligent web scraping OpenAI GPT-4.1-mini for keyword and SEO analysis Google Sheets for live tracking and reporting It’s a complete AI-powered SEO intelligence pipeline ideal for teams that want actionable insights on keyword gaps, optimization opportunities, and content focus trends, without relying on expensive SEO SaaS tools.

Ranjan DailataBy Ranjan Dailata
161

AI-powered candidate nurturing with scheduled WhatsApp & Gmail follow-ups

What This Workflow Does This workflow automates the candidate nurturing process, solving the common problem of candidates losing interest or "ghosting" after an application. It keeps them engaged and informed by sending a personalized, multi-channel (WhatsApp & Gmail) sequence of follow-up messages over their first week. The automation triggers when a new candidate is added to your ATS (e.g., via a Recrutei webhook). It then uses AI to generate a custom 3-part message (for Day 1, Day 3, and Day 7) tailored to the candidate's age and the specific job they applied for, ensuring a professional and empathetic experience that strengthens your employer brand. How it Works Trigger: A Webhook node captures the new candidate data from your Applicant Tracking System (ATS) or form. Data Preparation: Two Code nodes clean the incoming data. The first (Separating information) extracts key fields and formats the phone number. The second (Extract age) calculates the candidate's age from their birthday to be used by the AI. AI Content Generation: The workflow sends the candidate's details (name, age, job title) to an AI model (AI Recruitment Assistant). The AI has a detailed system prompt to generate three distinct messages for Day 1 (Thank You), Day 3 (Friendly Reminder), and Day 7 (Final Reinforcement), adapting its tone based on the candidate's age. Split Messages: A Code node (Separating messages per days) receives the single text block from the AI and splits it into three separate variables (day1, day3, day7). Day 1 Send: The workflow immediately sends the day1 message via both Gmail and WhatsApp (configured for Evolution API). Day 3 Send: A "Wait" node pauses the workflow for 2 days, after which it sends the day3 message. Day 7 Send: Another "Wait" node pauses for 4 more days, then sends the final day7 message, completing the 7-day nurturing sequence. Setup Instructions This workflow is plug-and-play once you configure the following 5 steps: Webhook Node: Copy the Test URL from the Webhook node and configure it in your ATS (e.g., Recrutei) or form builder to trigger whenever a new candidate is added. Run one test submission to make the data structure visible to n8n. AI Credentials: In the AI Recruitment Assistant node, select or create your OpenAI API credential. MCP Credential (Optional): If you use a Recrutei MCP, paste your endpoint URL into the MCP Recrutei node. Gmail Credentials: In all three Message Gmail nodes (Day 1, 3, 7), select or create your Gmail (OAuth2) credential. Optional:* In the same nodes, go to Options and change the Sender Name from your_company to your actual company name. WhatsApp (Evolution API): This template is pre-configured for the Evolution API. In all three Message WhatsApp nodes (Day 1, 3, 7), you must: URL: Replace {server-url} and {instance} with your Evolution API details. Headers: In the "Header Parameters" section, replace yourapikey with your actual Evolution API key.

Recrutei  Automações By Recrutei Automações
54

Create personalized email outreach with AI, Telegram bot & website scraping

Demo Personalized Email This n8n workflow is built for AI and automation agencies to promote their workflows through an interactive demo that prospects can try themselves. The featured system is a deep personalized email demo. --- 🔄 How It Works Prospect Interaction A prospect starts the demo via Telegram. The Telegram bot (created with BotFather) connects directly to your n8n instance. Demo Guidance The RAG agent and instructor guide the user step-by-step through the demo. Instructions and responses are dynamically generated based on user input. Workflow Execution When the user triggers an action (e.g., testing the email demo), n8n runs the workflow. The workflow collects website data using Crawl4AI or standard HTTP requests. Email Demo The system personalizes and sends a demo email through SparkPost, showing the automation’s capability. Logging and Control Each user interaction is logged in your database using their name and id. The workflow checks limits to prevent misuse or spam. Error Handling If a low-CPU scraping method fails, the workflow automatically escalates to a higher-CPU method. ⚙️ Requirements Before setting up, make sure you have the following: n8n — Automation platform to run the workflow Docker — Required to run Crawl4AI Crawl4AI — For intelligent website crawling Telegram Account — To create your Telegram bot via BotFather SparkPost Account — To send personalized demo emails A database (e.g., PostgreSQL, MySQL, or SQLite) — To store log data such as user name and ID 🚀 Features Telegram interface using the BotFather API Instructor and RAG agent to guide prospects through the demo Flow generation limits per user ID to prevent abuse Low-cost yet powerful web scraping, escalating from low- to high-CPU flows if earlier ones fail --- 💡 Development Ideas Replace the RAG logic with your own query-answering and guidance method Remove the flow limit if you’re confident the demo can’t be misused Swap the personalized email demo with any other workflow you want to showcase --- 🧠 Technical Notes Telegram bot created with BotFather Website crawl process: Extract sub-links via /sitemap.xml, sitemap_index.xml, or standard HTTP requests Fall back to Crawl4AI if normal requests fail Fetch sub-link content via HTTPS or Crawl4AI as backup SparkPost used for sending demo emails --- ⚙️ Setup Instructions Create a Telegram Bot Use BotFather on Telegram to create your bot and get the API token. This token will be used to connect your n8n workflow to Telegram. Create a Log Data Table In your database, create a table to store user logs. The table must include at least the following columns: name — to store the user’s name or Telegram username. id — to store the user’s unique identifier. Install Crawl4AI with Docker Follow the installation guide from the official repository: 👉 https://github.com/unclecode/crawl4ai Crawl4AI will handle website crawling and content extraction in your workflow. --- 📦 Notes This setup is optimized for low cost, easy scalability, and real-time interaction with prospects. You can customize each component — Telegram bot behavior, RAG logic, scraping strategy, and email workflow — to fit your agency’s demo needs. 👉 You can try the live demo here: @emaildemobot ---

Michael A PutraBy Michael A Putra
474