Excel has no single "import a whole folder" button, but you can bring in many XML files at once by loading them through Power Query, which can combine files from a folder into one table in a few steps. If your XML files are simple, flat lists (one repeating record per file), the built-in Data > Get Data > From File > From Folder route works well. If they have nested, deeply structured tags, you will likely need to import them one at a time or restructure them first, because Excel expects a fairly regular shape before it can stack files into rows. The steps below focus on desktop Excel for Windows; Mac has Get Data in current versions too, but the folder-combining wizard is more limited, and labels can differ slightly by version, device or region.

What You'll Need

  • Desktop Excel (Microsoft 365 or Excel 2016 and later). The online version of Excel does not offer the folder import route.
  • Your XML files saved together in one folder, with no unrelated files mixed in and ideally identical structure.
  • Power Query enabled. It is built into desktop Excel; if Data > Get Data is missing, the feature has been disabled by an administrator.
  • A sample of one file opened in a text editor (Notepad is fine) so you can see the tag names.

Step-by-Step

  1. Clean up the folder. Put only the XML files you want to import into a dedicated folder. If other file types sit in the same folder, the folder connector will try to load them too and produce errors. Note whether the files share one root tag and one repeating record tag - that is what makes combining possible.
  2. Inspect one file first. Open a single XML in Notepad. Look for the pattern of repeating elements, for example many <record> blocks inside a <records> wrapper. The name of that repeating element is what you will expand later. Note any attributes (values written inside the tag) because they need separate handling.
  3. Start the import. In Excel, go to Data > Get Data > From File > From Folder. Paste or browse to your folder path and click OK. Excel lists every file with columns for name, extension, date modified and folder path.
  4. Filter to XML only. Use the filter arrow on the Extension column and tick only .xml. This removes any stray text or spreadsheet files and prevents failed rows in the next step.
  5. Combine the files. Click Combine and then Combine Files. Excel opens a sample file and asks you to choose the object to extract. Select the repeating record element if it is listed, or the root element if not, then click OK.
  6. Check the applied steps. On the right, Power Query records each transformation. Click through the steps one by one, especially the Source and the expanded-table step. If the preview shows a column of Tables instead of data, click the expand icon (two arrows) in the column header and choose the fields you want.
  7. Fix type and header issues. If column headers are wrong, use Transform > Use First Row as Headers on the expanded table. Set data types manually (whole number, date, decimal) rather than accepting Any, because mixed types cause conversion errors on load.
  8. Remove helper columns. The combined query often keeps a Source.Name column showing which file each row came from. Either keep it (useful for auditing) or delete it with right-click > Remove Column.
  9. Load it. Click Close & Load to place the result on a new worksheet as a table, or Close & Load To to choose a pivot table, connection only, or a specific cell. A table is the easiest to filter and refresh.
  10. Refresh when files change. Add, remove or edit XML files in the folder, then right-click the table and choose Refresh. Power Query re-reads the folder and rebuilds the combined table automatically - this is the main reason to use the folder method rather than importing each file by hand.

Common Mistakes

  • Mixing differently shaped files. If one XML has an extra nested level or a differently named record tag, the combined query either drops fields or errors. Keep one folder per schema.
  • Forgetting attributes. Values stored as tag attributes (for example id="12") do not appear as normal elements. Expand the Attributes column or convert attributes to columns before combining.
  • Leaving stray files in the folder. A readme or JSON file will break the combine step; filter by extension first.
  • Assuming online Excel works the same. Excel for the web can open a single XML but does not provide the folder-combine wizard; use desktop Excel.
  • Deleting the source files. A refresh will fail if the folder is moved or emptied. Keep the folder in a stable location, not a temporary downloads directory.

Tips

  • Name files with a consistent prefix so the Source.Name column sorts neatly and you can tell where each row originated.
  • Keep the query definition but drop the loaded table's formatting issues: load to a table, then apply formatting on the worksheet, not inside Power Query.
  • For very large batches, load to the Data Model (connection only) and build a PivotTable on top, which handles repeated refreshes better than a wide sheet.
  • If the XML is a single flat record per file, the simpler route is Data > Get Data > From File > From XML for each file, then append the resulting tables with Data > Get Data > Combine Queries > Append.
  • Save a copy of the workbook before experimenting; repeated query edits on large folders can be slow to undo.

Troubleshooting

"We found extra columns" or an empty preview. The chosen sample file may not match the others. Delete the combined query, then combine again and pick a file you know is representative. Check that the record element name is identical in each file.

Error rows saying the file could not be parsed. One file is malformed - often an unclosed tag or a saved-as-HTML file with an .xml extension. Open it in a browser; if it shows errors, fix or exclude that file.

Columns come in as Table values. That means nested elements were not expanded. Click the expand icon in the column header and choose the sub-fields, repeating the expansion for each nested level.

Everything loads but dates or numbers are text. Change the type on the column header in Power Query, not on the worksheet, so refresh keeps the correct type. Watch for regional formats: a date like 03/04/2025 is ambiguous and should be converted explicitly.

Refresh fails after moving the folder. Open the query in Power Query, edit the Source step, and point it at the new path. Then click Refresh All.

Duplicate rows appear. Some XML wrappers repeat metadata at the top of each file, so expansion duplicates header values across rows. Remove the metadata columns or filter to the record level before loading.

Frequently Asked Questions

Can Excel import several XML files in one go?

Yes, on desktop Excel, using Data > Get Data > From File > From Folder and then Combine Files. Excel for the web does not offer this.

Do the XML files need identical structure?

They should share the same repeating record element and field names. Different structures usually need separate folders and separate queries, appended afterwards.

Why are my attribute values missing?

Attributes are not returned as ordinary columns. Expand the Attributes column during the transform step, or convert them to columns before combining.

Will the table update when I add new files?

Yes. Adding or replacing files in the folder and choosing Refresh re-runs the query and includes the new data.

Can I import XML from a website or API instead?

Use Data > Get Data > From Web and enter the URL. Excel parses the returned XML the same way, but the site must be reachable and the response must be valid XML.

Does Power Query handle nested XML well?

It can, but each nesting level must be expanded manually. Deeply nested files are often easier to flatten with a script first and then import as a single table.