cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Poisedon Frequent Visitor
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

Accepted Solutions
v-jiascu-msft Super Contributor
Super Contributor

Re: Importing data from multiple XML files

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
Super User
Super User

Re: Importing data from multiple XML files

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"

I have book! Learn Power BI from Packt


Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!

Poisedon Frequent Visitor
Frequent Visitor

Re: Importing data from multiple XML files

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

v-jiascu-msft Super Contributor
Super Contributor

Re: Importing data from multiple XML files

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

Helpful resources

Announcements
Ask Amanda Anything Q&A

Ask Amanda Anything Q&A

Learn the answers to some of the questions asked during the Amanda Triple A event.

October 2019 Community Highlights

October 2019 Community Highlights

October was a busy month in the community. Read the recap article to learn about some of the events and content.

New Solution Badges

New Solution Badges

Two waves of brand new solution badges are coming! Read the article for more information on our new community badges.

Analytics in Azure virtual event

Analytics in Azure virtual event

Experience a limitless analytics service built to ingest, prep, manage, and serve data for immediate use in Power BI.

Users Online
Currently online: 146 members 1,615 guests
Please welcome our newest community members: