Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
HI, Do you know a way to access the lastest excel file uploaded to a Sharepoint folder?
I need to based my access in Upload latest date, not by name of the file.
Thanks
Reggie
Solved! Go to Solution.
Hi @reggierevello,
Based on my test, The M code below should work in this scenario.
let Source = SharePoint.Files("https://mytenant.sharepoint.com/teams/abc", [ApiVersion = 15]), #"Sorted Rows" = Table.Sort(Source,{{"Name", Order.Descending}}), #"Kept First Rows" = Table.FirstN(#"Sorted Rows",1), #"Invoke Custom Function1" = Table.AddColumn(#"Kept First Rows", "Transform File from Query1", each #"Transform File from Query1"([Content])), #"Renamed Columns1" = Table.RenameColumns(#"Invoke Custom Function1", {"Name", "Source.Name"}), #"Removed Other Columns1" = Table.SelectColumns(#"Renamed Columns1", {"Source.Name", "Transform File from Query1"}), #"Expanded Table Column1" = Table.ExpandTableColumn(#"Removed Other Columns1", "Transform File from Query1", Table.ColumnNames(#"Transform File from Query1"(#"Sample File"))), #"Changed Type" = Table.TransformColumnTypes(#"Expanded Table Column1",{{"Source.Name", type text}, {"Product", type text}, {"Category", type text}, {"Segment", type text}, {"ManufacturerID", Int64.Type}, {"Manufacturer", type text}}) in #"Changed Type"In addition, here is a good article about loading the newest excel file from a Folder which is similar to loading from SharePoint Folder for your reference.
![]()
Above is a solution I mentioned in this similar thread. ![]()
Regards
Hi @reggierevello,
Based on my test, The M code below should work in this scenario.
let Source = SharePoint.Files("https://mytenant.sharepoint.com/teams/abc", [ApiVersion = 15]), #"Sorted Rows" = Table.Sort(Source,{{"Name", Order.Descending}}), #"Kept First Rows" = Table.FirstN(#"Sorted Rows",1), #"Invoke Custom Function1" = Table.AddColumn(#"Kept First Rows", "Transform File from Query1", each #"Transform File from Query1"([Content])), #"Renamed Columns1" = Table.RenameColumns(#"Invoke Custom Function1", {"Name", "Source.Name"}), #"Removed Other Columns1" = Table.SelectColumns(#"Renamed Columns1", {"Source.Name", "Transform File from Query1"}), #"Expanded Table Column1" = Table.ExpandTableColumn(#"Removed Other Columns1", "Transform File from Query1", Table.ColumnNames(#"Transform File from Query1"(#"Sample File"))), #"Changed Type" = Table.TransformColumnTypes(#"Expanded Table Column1",{{"Source.Name", type text}, {"Product", type text}, {"Category", type text}, {"Segment", type text}, {"ManufacturerID", Int64.Type}, {"Manufacturer", type text}}) in #"Changed Type"In addition, here is a good article about loading the newest excel file from a Folder which is similar to loading from SharePoint Folder for your reference.
![]()
Above is a solution I mentioned in this similar thread. ![]()
Regards
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.