Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi,
I am new on this community so I hope this is the right place where to ask help for my issue.
My power BI file was set to import .txt files from a folder, however the extension type of some of these files have been changed from .txt to .xlsx; so right now inside the folder there are both .txt and .xlsx files. When I update the Power BI file these .xlxs files are uploaded but completely "blank" (the information within these files is not loaded), so I would like to know if it is possible to import files with different extensions from the same folder or if I have to import them separately.
Thanks in advance
Solved! Go to Solution.
You can modify your Power Query code to use different file ingestion routines (called functions) depending on the extension type of the file. Note that .xlsx files have a totally different structure (and potentially many tabs that you need to choose from) than plain .txt files.
Something like this
let
Source = SharePoint.Files("https://xxx.sharepoint.com/teams/yyy", [ApiVersion = 15]),
#"Filtered Rows" = Table.SelectRows(Source, each ([Extension] = ".txt" or [Extension] = ".xlsx")),
#"Get File Contents" = Table.AddColumn(#"Filtered Rows", "File", each if [Extension]=".txt" then GetTXT([Content]) else GetXLSX([Content]))
in
#"Get File Contents"
@Davide_V , Import a excel file separately. Go go data transformation/ Edit Query mode. Right-click on the table and open the Advance editor.
Take this code.
Do the same with the text file.
Now compare the code and move the changes in excel source code text source code.
Take care of Path , column name and Type
You can modify your Power Query code to use different file ingestion routines (called functions) depending on the extension type of the file. Note that .xlsx files have a totally different structure (and potentially many tabs that you need to choose from) than plain .txt files.
Something like this
let
Source = SharePoint.Files("https://xxx.sharepoint.com/teams/yyy", [ApiVersion = 15]),
#"Filtered Rows" = Table.SelectRows(Source, each ([Extension] = ".txt" or [Extension] = ".xlsx")),
#"Get File Contents" = Table.AddColumn(#"Filtered Rows", "File", each if [Extension]=".txt" then GetTXT([Content]) else GetXLSX([Content]))
in
#"Get File Contents"
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
73 | |
72 | |
38 | |
31 | |
26 |