Convert CSV to XML

Turn a spreadsheet export into XML records.

XML

About this converter

Nearly always because something on the other end takes XML and will not take a spreadsheet — an import routine, an older integration, a product feed.

Each row becomes one element and each column becomes a child element named after its header. The whole lot is wrapped in a root element, because XML permits exactly one.

Column names have to become element names, which have rules: they cannot start with a digit and cannot contain spaces. A header of "Order Date" does not make a legal element name, so check the output if your headers are written for people rather than machines — renaming the columns before converting gives a cleaner result than anything this page could guess.

Frequently asked questions

My column names have spaces in them. What happens?

XML element names cannot contain spaces or start with a digit, so a header like "Order Date" or "2024 total" produces a name that is not strictly legal. Rename the columns in the CSV first — that gives a predictable result, where any automatic mangling would not.

Can I make the columns into attributes instead of elements?

Not directly here. Convert to JSON first, prefix the keys you want as attributes with @_, then use the JSON to XML page — that is the convention it reads.

Does what I paste get sent anywhere?

No. The conversion runs in your browser, on your own machine, which is why the result appears as you type. What you paste is not uploaded or logged.

Related tools