Why so complicated? Just open the File with File->Open choose xml and load it. See what'll happen.
Answer from Friedrich on Stack OverflowTranslate XML-File into Excel-Table and back again
Transform XML data in excel
Quick convert XML to Excel - Stack Overflow
Convert xml to excel/csv
Can XML file be converted to Excel?
Steps to Convert XML to Excel:
- Upload XML file
- Click 'Run Conversion' button
- When the file is converted - download Excel file
How do I open an XML file in Excel?
Steps to use XML to Excel Converter:
- Upload XML file
- Click 'Run Conversion' button
- When the file is converted - download Excel file
- Open Excel file in Microsoft Excel
Videos
I have this xml file as an export from one of our systems. It contains a dictionary and should be translated in all of the languages there. The idea is to write this file to a excel file, than give it to a translation office and then transform it back to this xml format.
I am not fixed on this idea. Maybe there is a much simpler way of getting the wanted result. The only important result is that I get this existing format back.
Thank you for any ideas guys!
Why so complicated? Just open the File with File->Open choose xml and load it. See what'll happen.
If you're using Excel 2007 and want to use XSLT, your best bet would probably be use the EXPath Zip Module features to modify an existing Excel .xslx file.
My preferred option, however, would be to use a small Excel VBA Macro.
I've included sample code below for a VBA procedure called 'load' - this sample uses the XML DOM, so all 112K rows of your XML will be first loaded into memory, but if performance isn't an issue its simpler than the SAX alternative.
You would need to modify xpathToExtractRow to suit your XML input structure. There is also an assumption that the immediate child nodes of the XML row element contain the cell data you wish to import as text nodes, if not, you will need to use a SelectNode call to get the data you require.
Private dom As DOMDocument60
Public Sub load()
Dim nodeList As IXMLDOMNodeList
Dim nodeRow As IXMLDOMNode
Dim nodeCell As IXMLDOMNode
Dim rowCount As Integer
Dim cellCount As Integer
Dim rowRange As Range
Dim cellRange As Range
Dim sheet As Worksheet
Dim xpathToExtractRow As String
xpathToExtractRow = "/feed/row"
Set dom = New DOMDocument60
dom.load ("c:\test\source.xml")
Set sheet = ActiveSheet
Set nodeList = dom.SelectNodes(xpathToExtractRow)
rowCount = 0
For Each nodeRow In nodeList
rowCount = rowCount + 1
cellCount = 0
For Each nodeCell In nodeRow.ChildNodes
cellCount = cellCount + 1
Set cellRange = sheet.Cells(rowCount, cellCount)
cellRange.Value = nodeCell.Text
Next nodeCell
Next nodeRow
End Sub
Sample Input XML:
<?xml version="1.0" encoding="utf-8"?>
<feed>
<row>
<firstname>joe</firstname>
<lastname>smith</lastname>
<country>jamaica</country>
</row>
<row>
<firstname>bill</firstname>
<lastname>coots</lastname>
<country>uk</country>
</row>
</feed>