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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
sundayDriver
Microsoft Employee
Microsoft Employee

Import logs files(txt format) from network share

Hi,

I wanted to import some log files for text processing. The files exist in multiple locations inside a network share.

The main flow is: Go to the root network share and then search all the subfolders to get all the files of type .txt.

Is there a way that I can do that?

Also does PowerBI support any processing of text, a.k.a could I use it of processing logs, extracting common error messages etc?

 

Thank you,

Lydia

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @sundayDriver,

Do all the text files have same structure(contain same number and name of columns)  ? If that is the case, you can perform the following steps to connect to them in Power BI Desktop. However, if the text files don't have same structure, Power BI Desktop will not merge the results from files correctly.

1. Open Power BI Desktop, and choose “Get Data->Blank query”, then click Advanced Editor, paste the following code in it. Please replace network share path with your own.
1.PNG

let
    Source = Folder.Contents("\\VYUEZH074204VM\test"),
    TypeAdded=Table.AddColumn(Source,"Type",each Value.Is([Content],type table)),
    Folders=Table.SelectRows(TypeAdded, each [Type]=true)
in
    Folders

2. Choose Content, Extensions and Folder path to expand the Content column as shown in the following screenshot.
2.PNG


3. Filter Content.Extension column to “.txt”.
3.PNG

4. Expand the Content.Content column by clicking double-arrow, then click OK in the pop-up windows.
5.PNG4.PNG

 

Reference:
http://radacad.com/fetch-files-andor-folders-with-filtering-and-masking-power-query

Thanks,
Lydia Zhang

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @sundayDriver,

Do all the text files have same structure(contain same number and name of columns)  ? If that is the case, you can perform the following steps to connect to them in Power BI Desktop. However, if the text files don't have same structure, Power BI Desktop will not merge the results from files correctly.

1. Open Power BI Desktop, and choose “Get Data->Blank query”, then click Advanced Editor, paste the following code in it. Please replace network share path with your own.
1.PNG

let
    Source = Folder.Contents("\\VYUEZH074204VM\test"),
    TypeAdded=Table.AddColumn(Source,"Type",each Value.Is([Content],type table)),
    Folders=Table.SelectRows(TypeAdded, each [Type]=true)
in
    Folders

2. Choose Content, Extensions and Folder path to expand the Content column as shown in the following screenshot.
2.PNG


3. Filter Content.Extension column to “.txt”.
3.PNG

4. Expand the Content.Content column by clicking double-arrow, then click OK in the pop-up windows.
5.PNG4.PNG

 

Reference:
http://radacad.com/fetch-files-andor-folders-with-filtering-and-masking-power-query

Thanks,
Lydia Zhang

hugoberry
Responsive Resident
Responsive Resident

Firstly use Get Data> Folder and get all the files in that root folder. Then filter the resultset to the files that you need. 

Afterwards you can expand the column with the contents of those log files, hoping that Power BI will merge them correctly.

Helpful resources

Announcements
October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors