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
pbiuser12345
Helper I
Helper I

Pulling Last Modified Date of Sharepoint File

Hello,

 

I have trying to build a query that pulls in the last modified date of an Excel file located on a Sharepoint site.  I ended with with a working query, but it has started to fail on me.  Looking at the M code, my guess is that it's pulling in the most recently modified file (the 0 index after it's been sorted descending) as opposed to pulling in a specific file by name, GUID, etc.

 

How could I update this query to be locked to the file I want?

 

Thanks for your help!

 

let
    Source = SharePoint.Tables("https://bmo.sharepoint.com/teams/XXXXXXX/Sharepoint Site", [Implementation=null, ApiVersion=15]),
    #"c26cac6a-c4a9-4a7e-a55c-XXXXXXXXXXXX" = Source{[Id="c26cac6a-c4a9-4a7e-a55c-XXXXXXXXXXXX"]}[Items],
    #"Sorted Rows" = Table.Sort(#"c26cac6a-c4a9-4a7e-a55c-XXXXXXXXXXXX",{{"Modified", Order.Descending}}),
    File = #"Sorted Rows"{0}[File],
    #"Converted to Table" = Record.ToTable(File)
in
    #"Converted to Table"
1 REPLY 1
lbendlin
Super User
Super User

After the items step add a step that filters the folder for your file name.  Then use the Modified field for that single row.

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.

Top Solution Authors
Top Kudoed Authors