Search code examples
xmlexcelexcel-2010

Export Data from excel to an XML schema has nested lists within nested lists


Is it possible to export Excel Data to an XML Files where the XML schema has nested lists within other nested lists?

What I have tried so far: Googling - I have found one thread that states it can not be done as Excel is inherently a flat table: https://social.msdn.microsoft.com/Forums/vstudio/en-US/8ded1f7a-2f9c-4c5a-aec5-c7bd6c594976/convert-data-from-excel-to-xml-when-schema-includes-list-of-lists?forum=vsto

Setting up fake data of two nested lists in an XML file and importing it into Excel. Excel's automatic recognition system works, but even if I do not change any of the displayed data, Excel doesn't allow me to export the file back into XML.

Here my sample XML Data:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Daten>
    <Mitarbeiter>
        <Vorname>Louis</Vorname>
        <Name>Rowbottom</Name>
        <Department>BDTP</Department>
        <Points>206</Points>
    </Mitarbeiter>
    <Workdays>
        <Holiday>1</Holiday>
        <Days>1</Days>
        <Days>1</Days>
        <Days>1</Days>
        <Days>1</Days>
        <Days>0</Days>
        <Days>0</Days>
        <Days>0</Days>
        <Sickdays>
            <Holiday>1</Holiday>
            <Days>1</Days>
            <Days>1</Days>
            <Days>1</Days>
            <Days>1</Days>
            <Days>0</Days>
            <Days>0</Days>
            <Days>0</Days>
        </Sickdays>
    </Workdays>
</Daten>

Solution

  • After having looked into this question for a considerable amount of time I have reached the following conclusion: it is NOT possible to export data from Excel into a XML Format using the onboard XML tools.

    The only way to do it is by either coding an XML export format in VBA or using a dedicated XML tool to read out an Excel file.

    Neither option is very good and i eventually abandonded my efforts to solve the problem in Excel at all.