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.
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
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
105 | |
105 | |
88 | |
73 | |
66 |
User | Count |
---|---|
122 | |
112 | |
98 | |
79 | |
72 |