Forum Discussion
palunel
9 years agoHelper I
How to programmatically set a dymanic URL
Hi there I want to read the daily exchange rates from www.xe.com but I need to cchange teh URL to include the correct date. Below is my code but this does not work: let
xDate = Text.From...
- 9 years ago
You can use Date.ToText to get the date in the required format.
Additionally I wouldn't rely on Source{0}, but address the required element.
let xDate = Date.ToText(DateTime.Date(DateTime.LocalNow()),"yyyy-MM-dd"), Source = Web.Page(Web.Contents("http://www.xe.com/currencytables/?from=ZAR&date=" & xDate )), Data0 = Table.SelectRows(Source, each [Id] = "historicalRateTbl"){0}[Data], #"Changed Type" = Table.TransformColumnTypes(Data0,{{"Currency code ▲▼", type text}, {"Currency name ▲▼", type text}, {"Units per ZAR", type number}, {"ZAR per Unit", type number}}) in #"Changed Type"
MarcelBeug
9 years agoCommunity Champion
You can use Date.ToText to get the date in the required format.
Additionally I wouldn't rely on Source{0}, but address the required element.
let
xDate = Date.ToText(DateTime.Date(DateTime.LocalNow()),"yyyy-MM-dd"),
Source = Web.Page(Web.Contents("http://www.xe.com/currencytables/?from=ZAR&date=" & xDate )),
Data0 = Table.SelectRows(Source, each [Id] = "historicalRateTbl"){0}[Data],
#"Changed Type" = Table.TransformColumnTypes(Data0,{{"Currency code ▲▼", type text}, {"Currency name ▲▼", type text}, {"Units per ZAR", type number}, {"ZAR per Unit", type number}})
in
#"Changed Type"Punitsetia
8 years agoNew Member
Does the data in the table changes automatically everyday or not by using it this query in Importing data.???