XML to Excel component
The XML to Excel component allows you to convert XML files into Excel documents.
Basic configuration
The XML to Excel component has the following basic configuration options:
Include header
Specify whether to include a header row in the Excel output.
Options
Yes
(default)No
- XML Input
- Excel Output - Yes
- Excel Output - No
<?xml version="1.0" encoding="UTF-8"?>
<breakfast_menu>
<food>
<name>food1</name>
<price>1</price>
<description>desc1</description>
</food>
<food>
<name>food2</name>
<price>2</price>
<description>desc2</description>
</food>
<food>
<name>food3</name>
<price>3</price>
<description>desc3</description>
</food>
</breakfast_menu>
"name","price","description"
"food1","1","desc1"
"food2","2","desc2"
"food3","3","desc3"
"food1","1","desc1"
"food2","2","desc2"
"food3","3","desc3"
Include index column
Specify whether to include an index column in the Excel output.
Options
Yes
No
(default)
When enabled, the index column will always be the first column and line numbers will be unquoted.
- XML Input
- Excel Output - No
- Excel Output - Yes
<?xml version="1.0" encoding="UTF-8"?>
<breakfast_menu>
<food>
<name>food1</name>
<price>1</price>
<description>desc1</description>
</food>
<food>
<name>food2</name>
<price>2</price>
<description>desc2</description>
</food>
<food>
<name>food3</name>
<price>3</price>
<description>desc3</description>
</food>
</breakfast_menu>
"name","price","description"
"food1","1","desc1"
"food2","2","desc2"
"food3","3","desc3"
"line","name","price","description"
1,"food1","1","desc1"
2,"food2","2","desc2"
3,"food3","3","desc3"
Index column name
Specify the name of the index column. The default value is line
.
Only available when Include index column is enabled.
Sort columns
Specify how the columns should be ordered in the Excel document (by name).
Options
Original
(default)Ascending
Descending
- XML Input
- Excel Output - Original
- Excel Output - Ascending
- Excel Output - Descending
<?xml version="1.0" encoding="UTF-8"?>
<breakfast_menu>
<food>
<name>food1</name>
<price>1</price>
<description>desc1</description>
</food>
<food>
<name>food2</name>
<price>2</price>
<description>desc2</description>
</food>
<food>
<name>food3</name>
<price>3</price>
<description>desc3</description>
</food>
</breakfast_menu>
"name","price","description"
"food1","1","desc1"
"food2","2","desc2"
"food3","3","desc3"
"description","name","price"
"desc1","food1","1"
"desc2","food2","2"
"desc3","food3","3"
"price","name","description"
"1","food1","desc1"
"2","food2","desc2"
"3","food3","desc3"
Excel format
Specify the format of the Excel output.
Options
XLSX (Excel 2007+)
(default)XLS (Excel 97-2007)
Advanced configuration
The XML to Excel component has the following advanced configuration options:
Use custom worksheets
Specify whether to enable custom worksheets.
Options
Yes
No
(default)
Custom worksheets
Define custom worksheets by specifying the following options for each sheet:
Worksheet
(name)XPath expression
(worksheet content)
Only available when Use custom worksheets is enabled.
Using XML to Excel
The XML should follow this structure:
<root>
<worksheet>
<element>
<subElement>
<subSubElement></subSubElement>
</subElement>
</element>
</worksheet>
</root>
Processing is supported up to the subSubElement
level.
<?xml version="1.0" encoding="UTF-8"?> <!-- structure tags: -->
<root> <!-- root -->
<items> <!-- worksheet -->
<item> <!-- element -->
<firstName>Joe</firstName> <!-- subElement -->
<lastName>Foo</lastName> <!-- subElement -->
<age>21</age> <!-- subElement -->
<description> <!-- subElement -->
<title>Title</title> <!-- subSubElement -->
<body>Body</body> <!-- subSubElement -->
</description> <!-- subElement -->
</item> <!-- element -->
<item> <!-- element -->
<firstName>John</firstName> <!-- subElement -->
<lastName>Doe</lastName> <!-- subElement -->
<age>30</age> <!-- subElement -->
<description> <!-- subElement -->
<title>Title</title> <!-- subSubElement -->
<body>Body</body> <!-- subSubElement -->
</description> <!-- subElement -->
</item> <!-- element -->
</items> <!-- worksheet -->
</root> <!-- root -->
- Only one type of
element
will be processed per worksheet, the first one that is encountered. - Header names are based on the unique
subElements
andsubSubElements
.SubSubElement
names include their parent element, formatted assubElement_subSubElement
.
- Multiple
subElements
orsubSubElements
with the same name inside the same parent are ignored.
Use the XSLT component or manually modify the XML to conform to the desired structure if:
- Attributes need to be processed.
- Non-unique
subElements
orsubSubElements
within the sameelement
need to be processed.