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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
jasmine9
Helper I
Helper I

How to automatically refresh when file name is slightly different each time (timestamp at the end)

HelloI have a requirement to load csv files from an internal tool into PowerBI. The challenge is that the generated filenames have a date/timestamp as the suffix. For eg, todays Employee file will be named as Employee_8_18_2020_21_30_09.csv

 

I thought I can change the datasource to have 3 filepath parts. 

1- Path+Employee

2-*

3-.csv

 

But I am getting the error "DataFormat.Error: Illegal characters in path."

 

Can you guide me on how to refresh data when the file name ends with different characters each time?

 

Thank you in advance,

Jas.

1 ACCEPTED SOLUTION
fhill
Resident Rockstar
Resident Rockstar

 

Import a FOLDER and 'Combine & Edit' to get to Power Query.  On the 'Source' Step you should have a list of files in the Folder.  While 'Source' is selected in Applied Steps, Add a Filter to the 'Name' column:

fhill_2-1597855489272.png

 

We are going to 'Filter' the File Names while on the 'Source' Step, to add a NEW Step removing the files we don't want...

fhill_1-1597855403974.png

 

fhill_3-1597855554562.png

 

Now a new 'Filtered Rows' step has appeared, and all following steps will not see the bad files.

fhill_4-1597855605557.png

 




Did I answer your question, or help you along the way?
Please give Kudos or Mark as a Solution!


https://www.linkedin.com/in/forrest-hill-04480730/

Proud to give back to the community!
Thank You!




View solution in original post

7 REPLIES 7
fhill
Resident Rockstar
Resident Rockstar

 

Import a FOLDER and 'Combine & Edit' to get to Power Query.  On the 'Source' Step you should have a list of files in the Folder.  While 'Source' is selected in Applied Steps, Add a Filter to the 'Name' column:

fhill_2-1597855489272.png

 

We are going to 'Filter' the File Names while on the 'Source' Step, to add a NEW Step removing the files we don't want...

fhill_1-1597855403974.png

 

fhill_3-1597855554562.png

 

Now a new 'Filtered Rows' step has appeared, and all following steps will not see the bad files.

fhill_4-1597855605557.png

 




Did I answer your question, or help you along the way?
Please give Kudos or Mark as a Solution!


https://www.linkedin.com/in/forrest-hill-04480730/

Proud to give back to the community!
Thank You!




Thank you for each one of you for contributing to this post! I got my data loads to work without any issues using the Import folder option and then using PowerQuery to filter the filename. 

Appreciate all your time on this!!

-Jas.

amitchandak
Super User
Super User

@jasmine9 , refer if this can help

https://medium.com/@wkrzywiec/getting-data-from-the-latest-file-in-a-folder-using-power-query-51dfa4...

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thank you for the suggestion. But the referred article implies that the import file is in its own unique folder. 

 

In my case, I have about 13 different files to import in my "Downloads" folder, so it would be manual work each day to move them into individual folders. 

Any way to change the data source to point to "starts with" filename instead of the complete filename?

 

Thanks,

Jas

If you import the folder as a whole, you should have a step where it'll list each file name, which you can then filter down like you want in Power Query

When I import the folder as a whole, PowerBI wants to combine all the files in the folder into one table. I have spent hours to try and see if I can change it, but it always seems to want to combine the files, even though the files have very different format.. 

@jthomson   I see what you mean. I can use powerquery to define filename "starts with". Let me run with this. I will provide an update, thank you!!

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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