Update Data from Web

smitpau

Board Regular
Joined
Apr 2, 2020
Messages
167
Office Version
  1. 365
Platform
  1. Windows
Hi,

I'd like to be able to update the data from the web based on a cell URL link.

The reason for this is if you look at the example below there is a specific date, this date will change over time (as only require a certain amount of history, say 1 year).

So ideally the web lookup would be dynamic but I can only seem to put a fixed URL into the from Web data source.

Hope that explains the issue clearly, any help appreciated, thanks for reading!


Example URL:
Original - https://api.exchangeratesapi.io/201...D,JPY,CHF,CAD,CNY,HKD,NZD,TRY,INR,BRL,ZAR,PLN
Updated (based on cell) - https://api.exchangeratesapi.io/201...D,JPY,CHF,CAD,CNY,HKD,NZD,TRY,INR,BRL,ZAR,PLN
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Ah yes that's what I'm after thanks.

It wouldn't necessarily need data validation though as the cell dates would auto-updated (so that 31/08/2019 would be 30/09/2019).

Not sure if that would cause a problem.

PS it's quite cool, haha.
 
Upvote 0
I don't get why changing that data validation cell changes the table, if you don't mind explaining probably quicker than me trying to back work it.
 
Upvote 0
you can remove DV and enter dates manually or somehow but the table should stay there (or moved to another place via drag&drop)

I don't get why changing that data validation cell changes the table, if you don't mind explaining probably quicker than me trying to back work it.
MAGIC ! :biggrin: :biggrin: :biggrin:
open Power Query Editor then Advanced Editor and you'll see why and how it works
 
Upvote 0
I've tried amending the table into the format I had in mind.



If I try the code below it comes up with this error might be because it's trying to return multiple dates.

Expression.Error: The column 'Date' of the table wasn't found.
Details:
Date

Attempted code (bold=Change):

let
Source = Excel.CurrentWorkbook(){[Name="[B]FX_List[/B]"]}[Content],
Date = Table.TransformColumnTypes(Source,{{"Date", type date}}){0}[Date],
Json = Json.Document(Web.Contents("https://api.exchangeratesapi.io/"&Date.ToText(Date,"yyyy-MM-dd")&"?base=GBP&symbols=EUR,SGD,USD,AUD,JPY,CHF,CAD,CNY,HKD,NZD,TRY,INR,BRL,ZAR,PLN")),
rates = Json[rates],
C2T = Record.ToTable(rates)
in
C2T

It
 
Upvote 0
Power Query works with columns and content

btw. why you enter this format date: 2016/08/31 ?
 
Upvote 0
Ah okay I see yours is the other way round, it's because that was the way the API used the date formatting but I see the code adjusts for that anyway.

I'll change to that format and see what happens.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,175
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top