瀏覽全部文件

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 分別是 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

下一頁

此頁面對你有幫助嗎?