Import of XML files

Excel has previously offered possibility to import XML files, but it was a rather tedious process because it was necessary to join the corresponding XML schema with the file. Although by definition it is simple, it often happened that my success, and others’ failure, could only be explained by the words: “Excel loves me and does not love you”. You will admit, this is not a fair explanation. Power Query maximally simplified this operation!

To begin with, you need one simple XML file, recorded on disk:

<?xml version=”1.0″ encoding=”UTF-8″?>
<notes>
<person>
<first>Petar</first>
<second>Petrović</second>
<phone>011/111222</phone>
</person>
<person>
<first>Marko</first>
<second>Marković</second>
<phone>011/333444</phone>
</person>
<person>
<first>Ana</first>
<second>Jović</second>
<phone>011/555666</phone>
</person>
</notes>

The import process is very simple, on the Data ribbon choose New Query / From File / From XML.

Then select the desired XML file. An import window will open where you should to select the entity on the basis of which the data is being grouped. In our case, it is a “person”. Power Query will automatically generate a preview on the right side of the window. By clicking on Load, data is imported into a structured table.