Automate MySQL to XLSX Export with n8n Workflow

Workflow Identifier: 2425
Automate MySQL to XLSX with n8n

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

What this workflow does

This workflow exports data from a chosen MySQL table into an Excel XLSX file automatically.
This stops the slow and error-prone manual process of running SQL queries and copying data to sheets.
With one click in n8n, the user gets a ready Excel file with all table data cleanly formatted.


Who should use this workflow

This workflow is useful for users who have regular weekly or monthly exports from a MySQL database.
Non-technical users needing a simple button to export data to share in Excel will find it handy.
Data analysts or team members wanting to avoid manual mistakes or wasted hours will benefit.


Tools and services used

  • n8n: Workflow automation platform.
  • MySQL: Source database storing tables.
  • Spreadsheet File node: Converts JSON data to XLSX files.
  • MySQL credentials in n8n: Securely connects to MySQL database.

Inputs, Processing Steps, and Output

Inputs

  • Table name to export (e.g., concerts2) provided as input in n8n.

Processing Steps

  • Run dynamic SQL query to get all data from given table.
  • Receive query output as JSON objects representing rows.
  • Use Spreadsheet File node to convert JSON into an Excel XLSX file.

Output

  • The workflow outputs a clean Excel XLSX file named after the table.

Beginner step-by-step: How to use this workflow in n8n production

1. Import the Workflow

  1. Download the workflow file using the Download button on this page.
  2. Open the n8n editor where you want to use this workflow.
  3. Click “Import from File” and select the downloaded workflow file.

2. Configure the Workflow

  1. Add or verify MySQL credentials under Credentials in n8n.
  2. Ensure the database user has read access to the target table.
  3. Check or update the table name in the node called Set if a different table needs exporting.
  4. Update file names or sheet names in the Spreadsheet File node if needed.

3. Test the Workflow

  1. Click “Execute Workflow” manually in n8n editor.
  2. Check that the output XLSX file appears and contains the expected data.

4. Activate Workflow

  1. Turn on the workflow to enable triggers or schedule automatic runs if desired.
  2. Optionally replace the manual trigger with a Cron node for scheduled exports.

By following these steps, users can start automating MySQL table exports to Excel quickly without rebuilding the workflow.
For privacy or performance, consider using self-host n8n.


Step-by-step workflow overview

  • Manual Trigger node starts the workflow on demand.
  • Set node defines the table name, e.g. concerts2.
  • MySQL node uses a dynamic query:
    =SELECT * FROM {{ $json["TableName"] }}

    This pulls all data from the table named in Set node.

  • Spreadsheet File node converts query JSON output to XLSX format.
  • Spreadsheet File node creates a file named like:
    = {{ $node["TableName"].json["TableName"] }}.{{ $parameter["fileFormat"] }}
  • Files generated contain all rows and columns with headers.
  • User can download or send this file automatically using extra nodes added later.

Customization ideas

  • Change table by editing Set node’s TableName value.
  • Add email node (Gmail or Send Email) to send XLSX file automatically.
  • Connect cloud storage nodes (Google Drive, Dropbox) to upload Excel exports.
  • Replace manual trigger with Cron node to schedule exports regularly.
  • Loop or multiple exports by duplicating nodes or adding foreach logic for multiple tables.

Common errors and fixes

  • Error: “Error establishing database connection”
    Cause: Wrong credentials or server offline.
    Fix: Update MySQL credentials in n8n under Credentials.
  • Error: Empty output or Excel file has no data
    Cause: Wrong table name or table empty.
    Fix: Double-check table name in Set node. Confirm data exists with a SQL client.
  • Error: Spreadsheet File node fails
    Cause: Unexpected data format or binary input.
    Fix: Make sure the input to Spreadsheet File node is JSON rows and not binary data.

Pre-production checklist

  • Check MySQL credentials have proper read access.
  • Confirm the database table exists and contains rows.
  • Run manual tests inside n8n to ensure output is correct.
  • Save backups of workflows before changes.

Deployment steps

Save the workflow in n8n editor.
Run the workflow manually to verify no errors.
Enable workflow to run on trigger or schedule.
Use execution logs to monitor success or troubleshoot.


Summary and Results

→ Exports MySQL table data to Excel XLSX automatically.
→ Saves manual time by running with one click.
→ Removes risk of copying mistakes or version errors.
→ Delivers clean spreadsheet named after table.
→ Easy to change tables, add emailing, or schedule.
→ Fits users needing quick, simple exports from database to Excel.


Automate MySQL to XLSX with n8n

Visit through Desktop to Interact with the Workflow.

Promoted by BULDRR AI

Related Workflows

Automate Twist Channel Creation and Messaging with n8n

This workflow automates creating and updating a channel in Twist and sending a personalized message to specific users. It eliminates manual setup errors and saves time managing Twist communications.

Automate Ideogram Image Generation with Google Sheets & Gmail

This workflow automates graphic design image generation via Ideogram AI, storing image data in Google Sheets and Google Drive, with email alerts via Gmail. It saves designers hours by automating image creation, remixing, review, and record-keeping.

Automate IT Support with Slack and OpenAI in n8n

Streamline IT support by automating Slack message handling using n8n and OpenAI. This workflow handles Slack DMs, filters bots, queries a Confluence knowledge base, and delivers AI-generated responses, improving support efficiency and response time.

Automate Crypto Analysis with CoinMarketCap & n8n AI Agent

Discover how this unique n8n workflow leverages CoinMarketCap’s multi-agent AI to deliver precise, real-time cryptocurrency insights directly via Telegram. Manage crypto data analysis efficiently with automated multi-source API integration.

Automate Gumroad to Beehiiv Subscriber Sync with n8n

Learn how to automatically add new Gumroad sales customers as Beehiiv newsletter subscribers using n8n automation. This workflow saves time by syncing sales data to Google Sheets CRM and notifying your Telegram channel instantly.

Generate On-Brand Blog Articles Using n8n and OpenAI

This workflow automates the creation of on-brand blog articles by analyzing existing company content using n8n and OpenAI. It extracts article structures and brand voice to produce consistent draft articles, saving significant content creation time.
1:1 Free Strategy Session
Your competitors are already automating. Are you still paying for it manually?

Do you want to adopt AI Automation?

Every hour your team does repetitive work, you're burning real money.
While you wait, faster businesses are cutting costs and moving quicker.
AI and automations aren't the future anymore — they're the present.

Book a live 1-on-1 session where we show you exactly which of your daily tasks can be automated — and what it’s costing you not to.