Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
cgkas
Helper V
Helper V

How to apply same query over multiple xml files?

Hi all,

 

I have a query that imports some specific nodes from a big nested xml file in power query for Excel. The query currently works for one xml and after parsing the XML, the ouput is placed in a worksheet. Now my issue is I have more than 600 xml files in a folder. and I would like to know how can I apply the same query to all files and append the result below the previous output in same worksheet?

 

My query for a single file looks like this:

 

 

 

let
    Source = Xml.Tables(File.Contents("D:\d\XML_Files\Inputfile_0021.xml")),
    Table1 = Source{1}[Table],
    #"Changed Type" = Table.TransformColumnTypes(Table1,{...}),
	Expand_table1 = ...
	Expand_table2 = ...
	Expand_table3 = ...
	.
	..
	...
	#"Reordered Columns" = ..
in
    #"Reordered Columns"

 

 

 Thanks in advance

1 ACCEPTED SOLUTION
ppm1
Solution Sage
Solution Sage

Try starting with the Folder connector (or better practice the SharePoint Folder connect and store the files in the cloud). Filter to just your xml files if needed, and then add a custom column with

 

= Xml.Tables([Content]){1}[Table]

 

I believe the column with the binary content is called Content (fix if not). You should then be able to expand out the data (assuming all the files have the same XML structure). If not, you can convert your original query into a function (with the binary content as the input), and use that instead.

 

Pat

 

Microsoft Employee

View solution in original post

1 REPLY 1
ppm1
Solution Sage
Solution Sage

Try starting with the Folder connector (or better practice the SharePoint Folder connect and store the files in the cloud). Filter to just your xml files if needed, and then add a custom column with

 

= Xml.Tables([Content]){1}[Table]

 

I believe the column with the binary content is called Content (fix if not). You should then be able to expand out the data (assuming all the files have the same XML structure). If not, you can convert your original query into a function (with the binary content as the input), and use that instead.

 

Pat

 

Microsoft Employee

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.