Forum Discussion
Get Data from SharePoint Folder with Today's Date
- 4 years ago
Hİ ,all I solved The problem.
I changed some M Language in advanced Editor like this
let Source = SharePoint.Files("https://unilever.sharepoint.com/sites/DaliyDisputeReport/", [ApiVersion = 15]), #"Daily-Dispute-Report_14 06 2022 xls_https://brbsapp266 sharepoint com/sites/DaliyDisputeReport/Shared Documents/General/" = Source{[Name="Daily-Dispute-Report_"&Date.ToText(Date.AddDays(DateTime.Date(DateTime.LocalNow()),-1),"dd.MM.yyyy")&".xls",#"Folder Path"="https://brbsapp266.sharepoint.com/sites/DaliyDisputeReport/Shared Documents/General/"]}[Content], #"Imported Excel Workbook" = Excel.Workbook(#"Daily-Dispute-Report_14 06 2022 xls_https://brbsapp266 sharepoint com/sites/DaliyDisputeReport/Shared Documents/General/"), #"Crm List_Sheet" = #"Imported Excel Workbook"{[Item="Crm List",Kind="Sheet"]}[Data], #"Promoted Headers" = Table.PromoteHeaders(#"Crm List_Sheet", [PromoteAllScalars=true]) inThank you
- 4 years ago
Hi sinanalmac ,
Connect to your SharePoint folder using the SharePoint Folder connector.
When the files list comes up in the connection dialog, hit the Transform button. This should give you a list of all files available from that folder, something like this:
Filter this table as you would a normal table, using a combination of filters on [Name], [Date modified], and [Date created] to create a generic set of filters that will always select 'today's' file from your folder.
For example, your filter arguments may look something like this:
Table.SelectRows( previousStepName, each Text.StartsWith([Name], "DailyDispute") and [Date created] = Date.From(DateTime.LocalNow()) )Once you've narrowed your table down to the one report for today, click the yellow "Binary" word in the [Content] column to open up that file in your query.
Pete
Hİ ,all I solved The problem.
I changed some M Language in advanced Editor like this
let
Source = SharePoint.Files("https://unilever.sharepoint.com/sites/DaliyDisputeReport/", [ApiVersion = 15]),
#"Daily-Dispute-Report_14 06 2022 xls_https://brbsapp266 sharepoint com/sites/DaliyDisputeReport/Shared Documents/General/" = Source{[Name="Daily-Dispute-Report_"&Date.ToText(Date.AddDays(DateTime.Date(DateTime.LocalNow()),-1),"dd.MM.yyyy")&".xls",#"Folder Path"="https://brbsapp266.sharepoint.com/sites/DaliyDisputeReport/Shared Documents/General/"]}[Content],
#"Imported Excel Workbook" = Excel.Workbook(#"Daily-Dispute-Report_14 06 2022 xls_https://brbsapp266 sharepoint com/sites/DaliyDisputeReport/Shared Documents/General/"),
#"Crm List_Sheet" = #"Imported Excel Workbook"{[Item="Crm List",Kind="Sheet"]}[Data],
#"Promoted Headers" = Table.PromoteHeaders(#"Crm List_Sheet", [PromoteAllScalars=true])
in
Thank you
- BA_Pete4 years agoSuper User
Wow, bad timing for my answer! 😂
I'd say that you might need to be careful with your solution if your file names are created manually by humans. In this case, there's a real chance that someone could mistype the date on the file name. With my solution, you're always picking up the file that was created today, regardless of how the date appears on the file name.
Pete