Forum Discussion
Switching from single xml-file and appended files to importing xml-folder
Hi,
Currently in Power Query, I import a xml-file for month 1 Region East and append xml-file for month 1 Region West, file for month 2 Region East, month 2 Region West and so on:
Instead of appending new files each month I want to import the entire folder with xml-files so that my report automtically import new xml-files whenever there are placed in the folder.
How can I do this without breaking my applied steps?
The beginning of my query looks like this:
Hello Anonymous
- Create one query that does exactly what you need
- Create a parameter "FileName" and maintain one complete path as value
- Enter in the advanced editor and change the part of the filename like "C:\.....\example.xlm" with your parameter like Folder.Contentes(FileName)
- rightclick on your query and select "create function". Call it "fnGetData"
- add a new query that reads your folder
- apply a filter that only the files that you need are visilbe
- add a new column and enter the following = fnGetData([Folder Path]&[Name])
- Exapand table
If this post helps or solves your problem, please mark it as solution.
Kudos are nice to - thanks
Have fun
Jimmy
10 Replies
- Jimmy801
Community Champion
Hello Anonymous
- Create one query that does exactly what you need
- Create a parameter "FileName" and maintain one complete path as value
- Enter in the advanced editor and change the part of the filename like "C:\.....\example.xlm" with your parameter like Folder.Contentes(FileName)
- rightclick on your query and select "create function". Call it "fnGetData"
- add a new query that reads your folder
- apply a filter that only the files that you need are visilbe
- add a new column and enter the following = fnGetData([Folder Path]&[Name])
- Exapand table
If this post helps or solves your problem, please mark it as solution.
Kudos are nice to - thanks
Have fun
Jimmy- AnonymousNot applicable
Hi Jimmy801
Sorry for my late response due to christmas vacation.
Some questions regarding your suggestion below;
- By "one query.. exactly what I need" you mean one query with all of the applied steps including where I also append the other xml files? (picture 1)- What does "maintain one complete path as value" means? How should I create the parameter? (picture 2)
pic1pic2
- Jimmy801
Community Champion
Hello Anonymous ,
no problem..
about your 2 questions:
no, create one query that processes only ONE xml file as you need it, without including any appending
create a parameter with the complete file path for ONE xml file, like that
the other steps as already stated in my solution
Hope this helps
Jimmy
- v-juanli-msft
Community Support
Hi Anonymous
Is this problem sloved?If it is sloved, could you kindly accept it as a solution to close this case?If not, please feel free to let me know.Best RegardsMaggie - Jimmy801
Community Champion
Hello Anonymous
were you able to solve the problem with any reply given?
If so, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
All the best
Jimmy