API Reference

Spreadsheets

Pull live currency conversions and rates into Google Sheets and Microsoft Excel using the CurrencyCore API.


You can call CurrencyCore straight from a spreadsheet. Because every request needs an Authorization header, the built-in IMPORTDATA (Sheets) and WEBSERVICE (Excel) functions aren’t enough on their own, use Apps Script in Google Sheets and Power Query in Excel, both shown below.

Keep your key out of shared cells. In Sheets, store it in Script Properties; in Excel, store it with the query credentials. Use a test key while you build.

Google Sheets

Open Extensions → Apps Script, paste the code below, and save. Then store your key under Project Settings → Script Properties as CC_KEY.

/**
 * =CC_CONVERT("USD", "INR", 100)  → converted amount
 * =CC_RATE("EUR", "USD")          → 1 EUR in USD
 */
function CC_CONVERT(from, to, amount) {
  const url =
    "https://api.currency-core.com/v1/convert" +
    "?from=" + encodeURIComponent(from) +
    "&to=" + encodeURIComponent(to) +
    "&amount=" + encodeURIComponent(amount);
  return ccFetch_(url).results[0].result;
}

function CC_RATE(base, quote) {
  const url = "https://api.currency-core.com/v1/rates/" + encodeURIComponent(base);
  return ccFetch_(url).rates[quote];
}

function ccFetch_(url) {
  const key = PropertiesService.getScriptProperties().getProperty("CC_KEY");
  const res = UrlFetchApp.fetch(url, {
    headers: { Authorization: "Bearer " + key },
    muteHttpExceptions: true,
  });
  return JSON.parse(res.getContentText());
}

Use them like any built-in function:

=CC_CONVERT("USD", "INR", 100)
=CC_RATE("EUR", "USD")

Custom functions are cached by Google. To force a refresh, change an argument or re-open the sheet, don’t call them thousands of times in a tight loop.

Microsoft Excel (Power Query)

Go to Data → Get Data → From Other Sources → Blank Query → Advanced Editor and paste this. It pulls every rate against a base currency into a table.

let
  Key   = "cc_live_your_key",
  Base  = "USD",
  Json  = Json.Document(
    Web.Contents(
      "https://api.currency-core.com/v1/rates/" & Base,
      [ Headers = [ Authorization = "Bearer " & Key ] ]
    )
  ),
  Rates = Record.ToTable(Json[rates])
in
  Rates

Rates becomes a two-column table (Name = currency, Value = rate per 1 unit of the base) you can reference from any cell with XLOOKUP / VLOOKUP.

To convert a single amount instead, query /v1/convert:

let
  Key  = "cc_live_your_key",
  Json = Json.Document(
    Web.Contents(
      "https://api.currency-core.com/v1/convert",
      [
        Query   = [ from = "USD", to = "INR", amount = "100" ],
        Headers = [ Authorization = "Bearer " & Key ]
      ]
    )
  )
in
  Json[results]{0}[result]

Refresh with Data → Refresh All (or set an automatic refresh interval under the query’s properties).

Notes

  • Spreadsheet calls count toward your plan’s monthly quota and rate limit like any other request, see Billing & Limits.
  • Country codes for PPP are ISO/IMF alpha-3 (see /countries).
  • Need help wiring this up? Email support.