Forum Discussion

EusebioJr_BR's avatar
EusebioJr_BR
New Member
1 year ago
Solved

Webscraping - Change the date filter

Hello! I want to do a webscrap in this website: Preços Históricos de GBP/JPY - Investing.com Portugal But there is a date filter in it and i need to set the final date to today's date. How can i ...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi EusebioJr_BR ,

    If you are trying to always automatically query data 30 days forward from the current day's date, you can try the following M code:

    = Table.SelectRows(#"Changed Type", each [Date] >= Date.AddDays(DateTime.Date(DateTime.LocalNow()), -30) and [Date] <= DateTime.Date(DateTime.LocalNow()))


    Here is the whole M code in the Advanced Editor:

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("bdQ9igMxEEThuyg2jKpb85c6MTiadDFz/2vsJq4GvQ3Fi/Sh0ufTXs/rff20R1NftC/RY/wdxtruxxQ3x8G4OibjcAzGdBRjOHZGfWOejN3xQDzddrTDbUMzT5LHOkkd4yRxbJO0MU2SxjL5j8y3xQRzLmmXOOYWdokdzS6xodklVjS7xECzSySaXSLQ7BJCs0t0NLsILmEXwUV2EVxkF8Gl5iS41JoElxqT4FJbElxqSoJLLUlwqSGBpWYEFaPAxCQQMQg86nOZS41nLvVE8Mp92Xbfvw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Moeda = _t, Date = _t, Value = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Moeda", type text}, {"Date", type date}, {"Value", Int64.Type}}),
        FilteredRows = Table.SelectRows(#"Changed Type", each [Date] >= Date.AddDays(DateTime.Date(DateTime.LocalNow()), -30) and [Date] <= DateTime.Date(DateTime.LocalNow()))
    in
        FilteredRows


    Best Regards,
    Dino Tao
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.