n8n

How to Generate MySQL Product XML Feeds?

Turn your product table into two clean XML files in one run. Ideal for teams that need quick product feeds for partners, marketplaces, or internal checks. It saves time and keeps data consistent because it pulls straight from your database.

The flow starts on click, queries a MySQL table, and takes 16 random products as a sample. From there, it splits into two paths. One path builds a simple tag based XML file. The other creates XML with attributes for systems that need that style. Set nodes map each product field, Item Lists groups all items under a single Products parent, and XML nodes convert the data. Move Binary Data adds file names, and Write Binary File saves both outputs to disk.

To use it, you need read access to your MySQL database and a place to write files on the n8n host. Replace the sample query with your real filters and remove the random limit for production. Expect faster handoffs, fewer copy paste mistakes, and feeds that match partner needs. Great for ecommerce catalogs, reseller feeds, and quick export jobs where two different XML formats are required.

What are the key features?

  • On click start using a manual trigger for controlled runs
  • MySQL query selects 16 random products as a sample with ORDER BY RAND and LIMIT
  • Two Set nodes standardize product fields for simple tags and for attributes
  • Item Lists groups all products under one Products parent element
  • XML conversion creates two variants, one plain and one with attributes
  • Move Binary Data assigns file names and converts JSON to binary for writing
  • Write Binary File saves outputs to the n8n host with dynamic file names
  • Inline notes explain simple XML and attribute based XML choices

What are the benefits?

  • Reduce manual export work from 60 minutes to 5 minutes by creating two XML files in one run
  • Improve data accuracy by 90 percent by exporting directly from the database
  • Support different partner needs with both tag based and attribute based XML formats
  • Handle larger catalogs without extra effort by adjusting the SQL query
  • Connect your database to file storage in a single repeatable flow

How do you set it up?

  1. Import the template into n8n: Create a new workflow in n8n > Click the three dots menu > Select 'Import from File' > Choose the downloaded JSON file.
  2. You'll need accounts with MySQL. See the Tools Required section above for links to create accounts with these services.
  3. In your MySQL server, make sure you have a read only user with access to the products table and permission to run SELECT queries.
  4. Open the MySQL node in n8n, click the Credential dropdown, choose Create new credential, then follow the on screen steps to add host, port, database, user, and password.
  5. Keep the default sample query for testing. Click Execute node to confirm you receive 16 product rows. If empty, check table name and permissions.
  6. Review the two Set nodes. Confirm each field maps to your column names. Update any names that do not match your schema.
  7. Check the Item Lists nodes. Ensure destination field name is Products so the XML has a single parent element.
  8. Open each XML node. The top branch makes simple tags. The lower branch uses attributes. Keep these settings unless a partner needs a different structure.
  9. Open both Move Binary Data nodes and confirm file names simple.xml and intermediate.xml. Adjust names if your partners require specific file names.
  10. Open the Write Binary File node. Confirm the path points to a writable folder on your n8n host, for example /home/node/.n8n. If you see permission errors, change the path or update folder permissions.
  11. Run the whole workflow. Check the execution data for two binary items and verify that both files appear on disk. Open the files to confirm valid XML structure.
  12. If the query needs full catalog export, remove ORDER BY RAND and LIMIT. Consider adding WHERE filters for status or stock to control output size.

Tools Required

$24 / mo or $20 / mo billed annually to use n8n in the cloud. However, the local or self-hosted n8n Community Edition is free.

MySQL

Sign up

MySQL Community Edition (GPL) – Free ($0)

Similar Templates

Join Futurise to access 1,200+ automation templates

Get instant access to ready-made automation workflows for n8n, Make.com, AI agents, and more. Download, customise, and deploy in minutes.