Take data from xml file and append it to excel table

hi everyone
i have an xml file and i want to take the variables from it
and to append them to my excel table
i thought of creating a data table and arrange them in the order in my excel file
but i couldnt create this table (create data table is only enter data by hand and not from variables that already saved from xml)

thanks for the help

@dlichten
Can you Share the XML or Sample XML data for further Analysis?

Hi @dlichten,
We can create datatable using build datatable activity, using variales too.
If you can extract required values from the xml, then you can easily insert into datatable using add data row activity. and also add that datatable to excel using write range activity.

as @ppr said, sharing the xml will help us to deliver more specific solutions.
Thanks

sorry it took me a long time to respond
image
the XML look like this
thank u ad again sorry for the delay

@dlichten

Assumptions:

  • we only have 1 record from 1 form (otherwise we have to extend the implementation, but would be possible to handle this as well)

Read In XML
grafik

Iteration over all elements under the form element and adding it to a dictionary:
grafik

Using the keys from the Dictionary and creating dynamicly the column structure in a datatable:
grafik

Adding the Values from Dictionary to the datatable:
grafik

Datatable can be used later for writing to excel.

Find demo xaml here:
dlichten.xaml (7.4 KB)

find demo xml here:
dlichten.xml (227 Bytes)

Let us know your feedback, Thanks

1 Like

in case you only need this conversion, it can easily be done in excel directly:
image

i used something like this:
“DT_Element.Element(“Form”).Element(“addrCity1”).Value”
i have more than 1 xml file but im using for each for all the files with .xml ending in the directory (saved the path in a variable and run on it)
and i did image
for all the xml details i need to use

But if u have something better to use
please im all ears