Forum Discussion
Dynamically Change date range of web source (api link)
- 3 years ago
AI14You need to include to and from in double quotes .... & "from=" & DateParameter & "to=" & DateParameter & ....
Thanks,
could this also be done if i set it yesterday instead of today?
also is it possible to have it linked to a cell where dat is entered?
AI14 Are you using Excel for this? Then you can create a new query from a particular cell and then reference that query in the above code.
- AI143 years agoHelper III
yes i am, sorry i didnt mention it.
- AntrikshSharma3 years agoCommunity Champion
AI14 Create a table in Excel with name DateParameter
And then you can load the table into PQ, the code will look like this:
let Source = Excel.CurrentWorkbook(){[ Name = "DateParameter" ]}[Content], ChangedType = Table.TransformColumnTypes ( Source, { { "Date", type datetime } } ), Date = Date.ToText ( Date.From ( ChangedType[Date]{0} ), [ Format = "yyyy-MM-dd", Culture = "en-US" ] ) in DateAs you can see the the data type of quer is just scalar text value now you can use the name DateParameter in your original code.
- AI143 years agoHelper III
ammazing and would this work for both from & to dates?
- AI143 years agoHelper III
would the code stay the same or do i need to reference the sheet, cell number?