Live exchange rates in Google Sheets
Wire exchangerate.dev into a custom =FXRATE() formula via Apps Script, with a cache and error handling. Free tier: 10,000 calls a month, no card.
To get live exchange rates in Google Sheets, paste a small Apps Script custom function that calls /v1/latest/{base} with your key in the Authorization header, then write =FXRATE("USD","EUR") in any cell. A free key covers 10,000 calls a month, no card. The function below caches for ten minutes and handles the two errors you will actually hit. It is the live FX input for a model or dashboard you keep in Sheets.
=FXRATE("USD","JPY") in any cell — no add-on to install./v1/latest/{base}?symbols={quote} returns the pair you ask for.Authorization: Bearer exr_live_...; CacheService keeps you inside the quota.Get a free API key
Sign up at exchangerate.dev/signup. After email confirmation your dashboard shows a key starting with exr_live_. Copy it — you will paste it into Apps Script next. The free tier is 10,000 calls a month, no card required.
Open Apps Script from your sheet
Open any Google Sheet. From the menu, click Extensions → Apps Script. A new tab opens with a default function myFunction() {}. Delete its contents — you will replace them in the next step.
Paste the FXRATE function
Replace the editor contents with this function. It calls exchangerate.dev, caches each pair for ten minutes via CacheService, and returns a readable marker for the two errors you can hit (401 and 429).
Use =FXRATE() in any cell
Back in the sheet, type =FXRATE("USD","EUR") in an empty cell. After about a second the cell shows the current rate. The same function works for any supported pair — swap the two currency codes:
Under the hood each call returns the base, the pair you filtered for, and two freshness fields — source and market_session — so you always know how current the number is:
llms.txt, so Claude, Cursor, or ChatGPT can read the live schema and write this function for you. Ask it: "build a Google Sheets custom function called FXRATE that takes a from and to currency and returns the live rate from exchangerate.dev, with a ten-minute cache." See the MCP guide.Refresh and free-tier fit
Apps Script does not re-run custom functions on a timer by itself. For periodic updates, add a time-driven trigger: in the Apps Script left rail, click Triggers → Add Trigger, choose FXRATE, source Time-driven, Minutes timer. The ten-minute cache plus the generous quota keeps a busy workbook safe:
- 10,000 calls a month, 12 requests a minute, no card
CacheServicereturns the cached rate for 10 minutes, so repeated edits cost nothing- Raise
CACHE_TTLif a sheet with many pairs ever brushes the per-minute cap - Covers
/v1/latest,/v1/convert,/v1/range, and/v1/{date}/{base}
notice field.