Pull CPI into Google Sheets with IMPORTDATA

Use the CSV endpoint and IMPORTDATA to auto-refresh CPI in a sheet.

Steps

  1. 1Call the .csv variant.
  2. 2Wrap in IMPORTDATA().

Code

cURL
curl https://api.ausdata.io/v1/data/abs/cpi.csv \
  -H "Authorization: Bearer YOUR_KEY"
Python
import requests
r = requests.get(
    "https://api.ausdata.io/v1/data/abs/cpi.csv",
    headers={"Authorization": "Bearer YOUR_KEY"},
)
print(r.json())
JavaScript
const r = await fetch("https://api.ausdata.io/v1/data/abs/cpi.csv", {
  headers: { Authorization: "Bearer YOUR_KEY" },
});
console.log(await r.json());

Watch out for

  • Sheets caches IMPORTDATA for an hour. That is fine for quarterly CPI.

Related

Try it now

500 free calls per month. No credit card.

Get a free API key