浏览全部文档

Sheets 链接

每一个以表格形式返回的地址、表格如何生成、链接的费用,以及出问题时单元格显示什么。

表格链接是一个 Narwhal 地址,它返回电子表格能读取的表格。它是一个普通的 GET 地址,带有 format=csv,末尾是 Sheets 密钥。

地址
https://api.narwhalapi.com/v1/fx/rates/USD?currencies=EUR,IDR&format=csv&key=YOUR_SHEETS_KEY
答案
currency,rate,timestamp,stale
EUR,0.90718,2026-11-15T16:00:00Z,false
IDR,18222.7,2026-11-15T16:00:00Z,false

参数

参数必填含义
format=csv是以表格形式返回。
key是来自仪表板 Team and keys 的 Sheets 密钥。这里不接受 API 密钥。
与该路由本身相同按该路由的说明与 JSON 调用相同的参数,例如 start、end、currencies、countries。

地址

替换大括号中的内容。国家是三个字母的代码,例如 USA。

数据https://api.narwhalapi.com 之后的地址
某一年的假期/v1/calendars/holidays/{country}/{year}
下一个假日/v1/calendars/holidays/{country}/next
发布日历/v1/economics/calendar
CPI,最新值和历史/v1/economics/{country}/cpi, /cpi/observations
通胀/v1/economics/{country}/inflation, /inflation/observations
GDP/v1/economics/{country}/gdp, /gdp/observations
GDP 增长率/v1/economics/{country}/gdp-growth, /gdp-growth/observations
失业率/v1/economics/{country}/unemployment, /unemployment/observations
劳动力参与率/v1/economics/{country}/labour-force-participation, /observations
贸易/v1/economics/{country}/trade, /trade/observations
任意序列/v1/economics/series/{series_id}/observations
政策利率/v1/economics/{country}/central-bank/policy-rate, /policy-rate/history
利率决议/v1/economics/{country}/central-bank/decisions
央行储备/v1/economics/{country}/central-bank/reserves
股权风险溢价,所有国家/v1/economics/equity-risk-premium
股权风险溢价,单个国家/v1/economics/{country}/equity-risk-premium, /history
大宗商品价格,全部/v1/commodities/spot
单个大宗商品/v1/commodities/spot/{commodity}/{currency}, /bars
汇率/v1/fx/rates/{base}, /observations, /bars
利率决议概率/v1/predictions/policy-paths/{authority}, /history

表格如何生成

  • 一行表头,之后每个条目一行。只返回一项内容的调用,返回一行。
  • 嵌套字段会变成用点号连接的列,例如 value.actual。
  • 由普通值组成的列表用 ; 连接。
  • 空值显示为空单元格。真和假写作 true 和 false。
  • 数字保留 API 返回的原始文本。
  • 发布日历每个发布一行,按时间排序。value_count 表示一个发布有多少个数值;这一行显示第一个。
  • 没有行的调用返回空结果。

链接的费用

链接就是带有你的密钥的地址。它在一天内第一次加载时,按该调用的正常价格收费。当天同一链接的其他加载都免费。日期在 UTC 午夜更换。只要修改地址的任何部分,就是一个新链接。

出问题时单元格显示什么

单元格显示一行文字。返回的 HTTP 状态码是 200,这样电子表格才会显示它;真实状态码在 x-narwhal-status 标头里。

单元格中的文字真实状态码
Narwhal: this Sheets key is switched off or not valid. Copy a new link from https://narwhalapi.com/dashboard.401
Narwhal: this is an API key, not a Sheets key. Make a Sheets key at https://narwhalapi.com/dashboard and use it in the link.401
Narwhal: a Sheets key reads data routes only, and the link must end in format=csv.403
Narwhal: out of credit. Add credit at https://narwhalapi.com/dashboard and refresh this sheet.402
Narwhal: too many requests. This sheet will update on its next refresh.429
Narwhal: bad parameter. (what is wrong)400 或 422

下一页

此页面对你有帮助吗?