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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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!:
The Definitive Guide to Power Query (M)

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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