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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Poisedon
Frequent Visitor

Importing data from multiple XML files

Hi all,

I'm trying to import data from all xml files in a folder. You know how to edit this code in the Query for take all xml files?

= #"Modificato tipo"{[#"Folder Path"="C:\Users\johnbyer\Desktop\Fatturazione attiva\",Name="10.xml"]}[Content]

 

I need to replace Name="10.xml" with a code or a function that make possible to take all xml files and not only 1. I'm a newbie please easy steps. I tried this https://community.powerbi.com/t5/Desktop/Import-multiple-XML-files/m-p/8900#M1596 but i dont know how to add a column and seems not working

 

I tried with "C:\Users\johnbyer\Desktop\Fatturazione attiva\*.xml" but not working

1 ACCEPTED SOLUTION

Hi @Poisedon,

 

Since you are using the Folder connector, you just need to follow the guidance of the connector GUI. Please refer to the snapshot below. Why did you need to replace the code?

Importing-data-from-multiple-XML-files

 

 

Best Regards,

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Greg_Deckler
Super User
Super User

You want to start with a Folder query. Once you enter your path, on the next screen choose Combine and Edit.

 

Should end up with something like this:

 

let
    Source = Folder.Files("c:\temp\powerbi\xml"),
    #"Filtered Hidden Files1" = Table.SelectRows(Source, each [Attributes]?[Hidden]? <> true),
    #"Invoke Custom Function1" = Table.AddColumn(#"Filtered Hidden Files1", "Transform File from xml", each #"Transform File from xml"([Content])),
    #"Renamed Columns1" = Table.RenameColumns(#"Invoke Custom Function1", {"Name", "Source.Name"}),
    #"Removed Other Columns1" = Table.SelectColumns(#"Renamed Columns1", {"Source.Name", "Transform File from xml"}),
    #"Expanded Table Column1" = Table.ExpandTableColumn(#"Removed Other Columns1", "Transform File from xml", Table.ColumnNames(#"Transform File from xml"(#"Sample File"))),
    #"Changed Type" = Table.TransformColumnTypes(#"Expanded Table Column1",{{"Source.Name", type text}, {"thing", type text}, {"value", Int64.Type}})
in
    #"Changed Type"

@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

Can you explain easier? I tried copying this code and editing path but still not working

Hi @Poisedon,

 

Since you are using the Folder connector, you just need to follow the guidance of the connector GUI. Please refer to the snapshot below. Why did you need to replace the code?

Importing-data-from-multiple-XML-files

 

 

Best Regards,

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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