3

Is there any way to craft an Excel hyperlink formula that would send an HTTP POST on click and parse the response to populate another cell?

Lance Roberts
  • 22,383
  • 32
  • 112
  • 130
Sean
  • 31
  • 3

3 Answers3

0
Public Function HttpPOST(ByVal URL As String) As String
    Set objHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")
    objHTTP.Open "POST", URL, False
    objHTTP.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
   objHTTP.send ("")
   myText = objHTTP.responseText
   getHTTP2 = myText

End Function
Tono Nam
  • 34,064
  • 78
  • 298
  • 470
0

[EDIT] Sorry, i didn't see "no vba" in your title. But i can't see how you would do.

You can do it with vba and find valuable information on these threads:

Here is a code sample:

'Send the request
Set objHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")
   URL = "http://www.somedomain.com"
   objHTTP.Open "POST", URL, False
   objHTTP.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)"
   objHTTP.send ("")

'Get the result
myText = objHTTP.responseText

'Set it in the current cell
ActiveCell.Value = myText

Regards,

Community
  • 1
  • 1
JMax
  • 26,109
  • 12
  • 69
  • 88
0

Use built-in excel formula,

=WEBSERVICE(A2)

enter image description here

This will populate content of the URL in the cell.

Vikash Kumar
  • 296
  • 3
  • 10