Format Code Now
/
ConvertExcel to XML Next: Word to HTML ›

Excel to XML Converter

CV-127

Open an .xlsx workbook and get well-formed XML: each sheet becomes a sheet element and each row a row element, with child elements named after your header row. Names are cleaned so the XML always parses.

Runs in your browser. Nothing is uploaded.

Excel file (.xlsx)

Drop a file here or use Open file. It is read on this device and never uploaded.

XML

How to use it

  1. Press Open file or drop an .xlsx file on the left pane, or press Sample to try one.
  2. Pick a sheet, or All sheets to wrap every sheet in one workbook element.
  3. Leave First row gives element names ticked to name elements after your headers, or untick it to use column letters.
  4. Choose how to write empty cells and the indent, then Copy or Download the .xml file.

The shape of the XML

One sheet gives a root element <sheet name="Orders"> holding one <row> per row that has values. Inside each row, every column becomes a child element in column order, such as <customer>Ada Lovelace</customer>. With All sheets, the sheet elements sit inside a <workbook> root. Empty cells can be written as an empty element such as <note/>, so every row has the same children, or left out to keep the file smaller.

How header text becomes a safe element name

XML element names cannot contain spaces, cannot start with a digit and should not start with xml, so headers are cleaned rather than rejected. order id becomes order_id, 1st becomes _1st, a colon becomes _ so no undeclared namespace prefix appears, and a name starting with xml gets a _ in front. A blank header uses the column letter, such as C, and a repeated header gets _2, _3. Letters with accents and other scripts are kept.

What happens to values

Text is escaped, so & and < in a cell become &amp; and &lt; and the output always parses. Numbers are written as Excel stored them, TRUE and FALSE become true and false, and dates become ISO text such as 2024-02-29T13:45:30. A formula gives its last saved result. XML 1.0 cannot hold most control characters at all, so a cell holding one stops the conversion and the error names the cell to fix.

Error messages and what to do

MessageWhat it meansFix
This is not an .xlsx file (it is not a ZIP package). Old .xls files are not supported; save as .xlsx first.The file is not an .xlsx workbook. It may be an old .xls file or a CSV with the wrong extension.Save the file as .xlsx in your spreadsheet program and open it again.
The file is password protected. Remove the password in Excel and try again.The workbook is encrypted, so its cells cannot be read without the password.Open it in Excel, remove the password, save, and open the saved copy here.

Questions people ask

How do I convert Excel data to XML?

Open the .xlsx file, pick the sheet and keep First row gives element names ticked. Each row of the sheet becomes a row element with one child per column, named after the header. Copy the result or download it as an .xml file.

What if my column headers have spaces or symbols?

They are turned into valid XML names: spaces and characters XML does not allow become underscores, a leading digit gets an underscore in front and a colon becomes an underscore. The text of the header is otherwise kept, so order id becomes order_id.

Can I choose my own root and row element names?

Not in this tool. The root is sheet (or workbook for several sheets) and each record is row, which keeps the structure predictable. Rename them with a find and replace on the output, or convert the sheet to JSON and use a JSON to XML tool with your own names.

Is the output valid XML?

It is well-formed: one root element, escaped text and valid names, with a UTF-8 XML declaration. It is not checked against a schema, because the tool does not know your target schema. Validate it against your XSD separately if you need that.

Is my workbook uploaded to convert it?

No. The file is unpacked and converted by your browser on this device. Nothing is sent to a server, so it is fine for files with customer or financial data.

About this tool

Each sheet becomes a <sheet name="..."> element holding one <row> per row that has values; with All sheets they sit inside a <workbook> root. Header text becomes the element name: characters XML does not allow become _, a name that starts with a digit gets a _ in front, a colon becomes _ so no namespace prefix is made, names starting with xml get a _, a blank header uses the column letter, and repeats get _2, _3. Values are escaped. TRUE and FALSE become true and false, dates become ISO text. Formatting and formulas are not copied, and a cell holding a control character that XML 1.0 cannot store stops the conversion with the cell named.

Format Code Now: free, no ads, no accounts. Your input stays in your browser.