excel - 从 Excel 中执行 HTTP Post 并解析结果

标签 excel http winhttprequest post vba

我可以访问 API。该 API 将 XML 帖子作为输入,然后返回带有相关数据的 XML 响应。

我要

  1. 将 HTTP Post 发送到服务器(身份验证和请求将一起发送)
  2. 接收响应(要返回的选项之一是 CSV 或 XML)
  3. 将数据插入适当的行和列,然后使用数据透视表进行数据分析。

我没有 excel 编程背景,但熟悉不同的网络脚本语言,HTML、CSS、Javascript 等。

有什么想法吗?

最佳答案

可以使用此 VBA 代码处理 Excel 请求端。

Sub GetStuff()

Dim objXML As Object
Dim strData As String
Dim strResponse As String

 strData = "Request"
 Set objXML = CreateObject("MSXML2.XMLHTTP")

 objXML.Open "POST", "www.example.com/api?" & strData, False
 objXML.Send
 strResponse = objXML.responsetext

MsgBox strResponse

End Sub

关于excel - 从 Excel 中执行 HTTP Post 并解析结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1820345/

相关文章:

Excel VBA函数无法设置范围

javascript - 使用 HTTP 身份验证自动登录的 GreaseMonkey 脚本

c - http服务器如何从客户端接收文件

autohotkey - WinHttpRequest 超时

vba - WinHttp.WinHttpRequest 添加到内容类型

excel - 生成协方差矩阵的更快方法

excel - 如何只允许某个字符在一行单元格中出现一次

excel - "Run-time error ' 1004 ' Cannot edit a macro on a hidden workbook. Unhide the workbook using the Unhide command"在功能区 XML 中使用 "onLoad"时

ruby - 如何使用 ruby​​ 将大文件从客户端传输到服务器?

httpwebrequest - Msxml2.ServerXMLHTTP 和 WinHttp.WinHttpRequest 之间的区别?