Load Data from Website with Java Script

Silent_Warrior5

New Member
Joined
Aug 11, 2018
Messages
4
hi all,
i want to load some table data from a java script website.
i use excel query connection and open the excel browser (think it is a old IE) and answer some scripts error message with "no, do not continue the script" and then the website loading and i close the excel browser and the macro works.
But today nothing work. This Error message appears:
Note: Since your browser does not support JavaScript, you must press the Resume button once to proceed.
ok it just load if i open the query and click error message and close the browser.
Ok i think the website need cookies or a token ( i find some line in the website text) . Where can i see what the website needs to login and work fine?
I test this marco but error was "forbidden"

Code:
Sub Dow_HistoricalData()

Dim xmlHttp As Object
Dim TR_col As Object, TR As Object
Dim TD_col As Object, TD As Object
Dim row As Long, col As Long

Set xmlHttp = CreateObject("MSXML2.XMLHTTP.6.0")
xmlHttp.Open "GET", "https://musterfirma.coupahost.com/receipts?cond%5B1%5D%5Bcol_key%5D=order_header_id&cond%5B1%5D%5Border_heade r_id%5D=1372229&cond%5B1%5D%5Border_header_id_op%5D=eq&search_mode=advanced", False

xmlHttp.setRequestHeader "Content-Type", "text/xml"
xmlHttp.Send

Dim html As Object
Set html = CreateObject("htmlfile")
html.body.innerHTML = xmlHttp.responseText

Dim tbl As Object
Set tbl = html.getElementById("curr_table")

row = 1
col = 1

Set TR_col = html.getelementsbytagname("TR")
For Each TR In TR_col
Set TD_col = TR.getelementsbytagname("TD")
For Each TD In TD_col
Cells(row, col) = TD.innerText
col = col + 1
Next
col = 1
row = row + 1
Next
End Sub
what code works that the macro login with token? or cookie or something and loading the table data?

Thx and cheers

Silent_Warrior5
 
Last edited by a moderator:

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
here the line with the token:

Code:
<title>Empfangen</title>
<link href='/assets/favicon-cd9......ico' rel='shortcut icon'>
****** name="csrf-param" content="authenticity_token" />
****** name="csrf-token" content="WfrZ........==" />
<!--[if lt IE 9]>
******** src="/assets/html5-e3b
 
Last edited by a moderator:
Upvote 0

Forum statistics

Threads
1,224,847
Messages
6,181,311
Members
453,031
Latest member
Chris_1

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