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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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