Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

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.

  •  

    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:

     

    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...

     

     

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

     

7 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      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

      • jthomson's avatar
        jthomson
        Icon for Solution Sage rankSolution Sage

        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

  • fhill's avatar
    fhill
    Icon for Resident Rockstar rankResident 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:

     

    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...

     

     

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

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      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.