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
- Download the workflow file using the Download button on this page.
- Open the n8n editor where you want to use this workflow.
- Click “Import from File” and select the downloaded workflow file.
2. Configure the Workflow
- Add or verify MySQL credentials under Credentials in n8n.
- Ensure the database user has read access to the target table.
- Check or update the table name in the node called Set if a different table needs exporting.
- Update file names or sheet names in the Spreadsheet File node if needed.
3. Test the Workflow
- Click “Execute Workflow” manually in n8n editor.
- Check that the output XLSX file appears and contains the expected data.
4. Activate Workflow
- Turn on the workflow to enable triggers or schedule automatic runs if desired.
- 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.

