【问题标题】:Get data from API in Excel 2016从 Excel 2016 中的 API 获取数据
【发布时间】:2018-09-04 11:24:57
【问题描述】:

我想使用针对 Toogl 的 rest API 将一些报告导入 Excel。 规格:https://github.com/toggl/toggl_api_docs/blob/master/reports.md

我有一个要使用的访问令牌。我可以轻松地在 Excel 中使用预定义的“获取数据”方法来导入数据吗?努力找出答案。

【问题讨论】:

    标签: excel rest api token


    【解决方案1】:

    这应该很容易做到。您可以按照this quick tutorial 使用XmlHttpRequest 在Excel 中执行GET 请求。每个教程的一个简单请求是:

    Dim xmlhttp As New MSXML2.XMLHTTP60, myurl As String
    myurl = "http://requestb.in/15oxrjh1" //replace with your URL
    xmlhttp.Open "GET", myurl, False
    xmlhttp.Send
    MsgBox(xmlhttp.responseText)
    

    根据您链接的 API 的身份验证是通过在请求中传递标头来完成的,如下所示:

    xmlhttp.setRequestHeader "Authorization", AuthCredentials
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-09-17
      • 2015-02-07
      • 1970-01-01
      • 2019-07-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多