Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Load Query Based on Dynamic File Name (SharePoint)

I'm looking to ensure my Power BI report pulls the latest data from a SharePoint file without having to overwrite the current sharepoint file with the latest data.   Each day a new file is received...
  • jeffshieldsdev's avatar
    4 years ago

    Steps would be like this:

    1. Use "SharePoint folder" connector to connect to the site using the site root URL.
    2. Click "Transform Data" button in preview window.
    3. Filter Folder Path to folder contain the files (will have a trailing "/").
    4. Filter Extension column to ".xlsx" .
    5. Duplicate "Name" column, and/or Replace Values in Name column to remove filter name prefix, so remaining text is "YYYYMMDDhhmmss).xlsx"
    6. Sort "Name" column Descending
    7. Click on "Binary" in first row of "Content" column to drill into the XLSX file, then drill into the desired Sheet. NOTE: the default generated Power Query code will used hard-coded named identifiers. You may want to edit this to use index or position-based identifiers instead.