XML in CSV or xlsx or something else

#1

Hey Guys, im totally new and im looking for an Idea or tipp how i can convert a XML file to Excel ?
Someone have an Idea maybe ?

Best regards
Philipp

0 Likes

#2

Hi there,

you have data in XML file which you read into KNIME and want to output it as a Excel file or?

Br,
Ivan

0 Likes

#3

Hi @PhilippBobo,

Use the XML Reader node to read the XML file, then the XPath node to extract what you need (you can remove the source column) and finally the Excel Writer (XLS) node exports the table to an Excel file.

:blush:

1 Like

#4

Hey Armin, yea i will try it. Do you think there is a problem if i have more then one .xml file ? :slight_smile:
Do you have perhabs a example workflow ?

Thanks so far.
Philipp

0 Likes

#5

No, there is no problem. Do you want to append all the XML files in one Excel file or do you want to write each file separately?

0 Likes

#6

I think i would like to separat it. Per xml file one excel file. :slight_smile:

0 Likes

#7

Then use a List Files node and then a Table Row To Variable Loop Start node and put the other nodes inside the loop and end the loop with a Variable Loop End node.

You can manipulate the file path in each loop with the String Manipulation (Variable) node to create the flow variable for the “Output location” option in the configuration window of the Excel Writer (XLS) node.

Here is an example:

xml_to_xlsx.knwf (39.9 KB)

:blush:

P.S. You can also use the Excel Sheet Appender (XLS) node to export each XML file in a new sheet.

2 Likes

#8

Really thank you Armin. I will try it tmr and give you feedback. Thanks

1 Like