Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Data refresh disabled for dynamic sharepoint excel files

Hi,

I have the following query that is giving me an error "You can't schedule refresh for this dataset because the following data sources currently don't support refresh. Data source for Query1"
My data source sits in a folder under a sharepoint site. And I want the data source to be dynamic so that it takes the folder that has the latest quarter's data. For example, I have folders like "Q1 2023", "Q2 2023", "Q4 2023", and the query would take the latest file on the folder (Q4 2023 for today). Below is my code on the query editor:

 

let
Source = Excel.Workbook(Web.Contents("https://XXXX.sharepoint.com/sites/XXX/Shared%20Documents/"&
"Q"&Text.From(Date.QuarterOfYear(DateTime.Date(DateTime.LocalNow()))-1) &" "& Text.From(Date.Year(DateTime.LocalNow()))&
"/Testing "&
"Q"&Text.From(Date.QuarterOfYear(DateTime.Date(DateTime.LocalNow()))-1)&" "
/*Following is the code to extract the last two digits of the Year. For example, 23 for 20223*/
&Text.End(Date.ToText(DateTime.Date(DateTime.LocalNow())),2)&" - XX.xlsx"), null, true),

 

1 Reply