how to get data from javascript to excel

teireii

New Member
Joined
Nov 28, 2012
Messages
5
Hello, i would like to ask about how can we get the data from a html which is using javascript to show data in a table.

Historical Exchange Rates | OANDA

i need to extract various kind of currency exchange rates from the site. from usd to other currency and vice versa. I tried to use the get external data from web function in excel, but the website may protect these kind of query so i cannot get the table i want. becase i need to input the original currency and target currency in the website, i cannot get the table without inputting the org and target currency. this is the only recognize site the company use, so i have to stick with this site..........

everyday i need to convert up to 2k times, is there any VBA for me to use so that i can run the code to auto extracting the exchange rate? thank you very much!!!!
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
got below codes for generating the rates:
<code style="margin: 0px; padding: 0px; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: inherit;">Sub GetRates()

Dim myURL As String, sFilename As String
Dim WinHttpReq As Object, oStream As Object

myURL
= "http://www.oanda.com/currency/historical-rates/download?quote_currency=USD&end_date=" & Format(Now(), "yyyy-m-d") & "&period=daily&display=absolute&rate=0&data_range=d60&price=bid&view=graph&base_currency_0=CAD&download=csv"
sFilename
= Environ$("USERPROFILE") & "\Desktop\rates.csv"


Set WinHttpReq = CreateObject("Microsoft.XMLHTTP")
WinHttpReq
.Open "GET", myURL, False
WinHttpReq
.Send

myURL
= WinHttpReq.ResponseBody

If WinHttpReq.Status = 200 Then
Set oStream = CreateObject("ADODB.Stream")
oStream
.Open
oStream
.Type = 1
oStream
.Write WinHttpReq.ResponseBody
oStream
.SaveToFile sFilename, 2
oStream
.Close
End If

End Sub</code>
 
Upvote 0

Forum statistics

Threads
1,216,077
Messages
6,128,673
Members
449,463
Latest member
Jojomen56

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