A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
You may refer the article given below for more information on how to import multiple XML data files into Excel, and check if that helps.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I have a lot of xml files which need to be imported into single excel file. I can able to import one by one but cannot select all at a time to import.
Is it possible to do through batch process or any other process?
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
You may refer the article given below for more information on how to import multiple XML data files into Excel, and check if that helps.
This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.
Comments have been turned off. Learn more
Hi,
try this code, in order to import ALL xml files into sheet1.
- Open a new wb
- save as .xlsm (macros enabled)
- in a regular module, paste the following code..
note: xml files are in path "c:\folder1\folder2\xml folder" (change as needed)
**Sub From_XML_To_XL()**On Error GoTo errh
Dim myWB As Workbook, WB As Workbook
Set myWB = ThisWorkbook
Dim myPath
myPath = "c:\folder1\folder2\xml folder" '<<< change path
Dim myFile
myFile = Dir(myPath & "*.xml")
Dim t As Long
t = 1
Application.ScreenUpdating = False
Do While myFile <> ""
Set WB = Workbooks.OpenXML(Filename:=myPath & myFile)
WB.Sheets(1).UsedRange.Copy myWB.Sheets(1).Cells(t, "A")
WB.Close False
t = myWB.Sheets(1).UsedRange.Rows.Count + 2
myFile = Dir()
Loop
Application.ScreenUpdating = True
myWB.Save
Exit Sub
errh:
MsgBox "no files xml"
End Sub
TasosK,
Thank you for this code. It works great. Is there anyway to modify it so that the headers do not display. When I import my 1000s of XML files, the XML map header comes up each time. I would ideally like just one header in row 1 and each following row just to be the data.
| /my:myFields | |
|---|---|
| /@xml:lang | /my:AnalysisView/my:InboundConcat |
| en-US | 65 AAA |
| /my:myFields | |
| /@xml:lang | /my:AnalysisView/my:InboundConcat |
| en-US | 65 BBB |
| /my:myFields | |
| /@xml:lang | /my:AnalysisView/my:InboundConcat |
| en-US | 97 CCC |
If possible, I would like the first two rows only to appear one time and not duplicated for each entry. So it would look like this when imported:
| /my:myFields | |
|---|---|
| /@xml:lang | /my:AnalysisView/my:InboundConcat |
| en-US | 65 AAA |
| en-US | 65 BBB |
| en-US | 97 CCC |
Thank you for your advice and assistance!
This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.
Comments have been turned off. Learn more
I have the same problem, following the same instructions.
Even trying to re-import the first file fails after the initial import.
This is really frustrating.