How to get live gold prices in Excel

Wire the goldprice.dev API into Excel via Power Query M. Refreshes on workbook open or manual click. Works on Mac and Windows.

Updated

To get live gold prices in Excel, paste a Power Query M query that calls api.goldprice.dev/v1/spot/XAU-USD-SPOT with your API key in the X-API-Key header, then load the resulting table into a worksheet. The free tier covers 1,000 calls/month, no credit card. Tested April 2026 against Excel for Microsoft 365 (Power Query M, cross-platform). Below: copy-pasteable query, multi-currency variants, refresh setup, and credentials walkthrough.

  1. 1.Get your goldprice.dev API key

    Sign up for a free account at goldprice.dev/onboarding. After email confirmation, your dashboard shows a key starting with goldprice_live_. Copy it — Power Query will ask you to paste it as a parameter in the next step.

    The free tier includes 1,000 calls/month and supports gold spot in 13 currencies. No credit card required.

    Get your free API key1,000 calls/mo, no credit card
    Sign up free →
  2. 2.Open the Power Query Editor

    From the Excel ribbon, click Data → Get Data → Launch Power Query Editor. In the editor, click Home → New Source → Blank Query. Then click View → Advanced Editor. You will paste the M query into that text box in the next step.

    Power Query M is the canonical Excel path: it works on Mac and Windows, supports scheduled refresh in Microsoft 365, and survives credential rotation cleanly.

  3. 3.Paste the GoldPrice M query

    Replace the editor contents with the query below, then click Done. Rename the query GoldPrice in the right rail. The RelativePath argument is required — without it, scheduled refresh in Power BI / Microsoft 365 fails with a credentials error.

    POWERQUERY · Power Query · Advanced Editor
    // excel: Power Query M query "GoldPrice"
    // curl-equivalent: https://api.goldprice.dev/v1/spot/XAU-USD-SPOT
    // Replace ApiKey with your goldprice.dev key from /onboarding
    let
        ApiKey = "goldprice_live_replace_with_your_key_here",
        Symbol = "XAU-USD-SPOT",
        Source = Json.Document(
            Web.Contents(
                "https://api.goldprice.dev",
                [
                    RelativePath = "v1/spot/" & Symbol,
                    Headers = [#"X-API-Key" = ApiKey],
                    ManualStatusHandling = {401, 429}
                ]
            )
        ),
        Result = #table(
            {"field", "value"},
            {
                {"symbol", Source[symbol] & "-" & Source[quote_currency]},
                {"price", Number.FromText(Source[price])},
                {"bid", Number.FromText(Source[bid])},
                {"ask", Number.FromText(Source[ask])},
                {"computed_at", Source[computed_at]},
                {"is_stale", Source[is_stale]}
            }
        )
    in
        Result
  4. 4.Load to a worksheet and pick credentials

    Click Home → Close & Load. Excel inserts a 6-row table on a new sheet showing symbol, price, bid, ask, timestamp, and stale flag. On first run, Excel prompts for credentials on the https://api.goldprice.dev data source — choose Anonymous (your key travels in the header, not the URL). Press Ctrl+Alt+F5 any time to refresh.

  5. 5.Switch currency or metal

    Edit the query, change the Symbol parameter, then refresh. Symbols are METAL-CURRENCY-SPOT across the 13 supported currencies. Multi-currency examples below.

    POWERQUERY · Power Query · multi-currency variants
    // USD spot — default
    Symbol = "XAU-USD-SPOT"
    
    // INR — Indian gold market (largest retail gold-search globally)
    Symbol = "XAU-INR-SPOT"
    
    // EUR — European pricing surfaces
    Symbol = "XAU-EUR-SPOT"
    
    // Silver in USD
    Symbol = "XAG-USD-SPOT"

Expected output

The API returns this shape:

JSON · GET /v1/spot/XAU-USD-SPOT
{
  "symbol": "XAU",
  "quote_currency": "USD",
  "unit": "troy_ounce",
  "contract_type": "spot",
  "price": "4726.01",
  "bid": "4726.68",
  "ask": "4725.33",
  "is_stale": false,
  "divergence_flag": false,
  "computed_at": "2026-04-27T04:49:01.706844+00:00",
  "sources": [
    {
      "source": "wgc.fsapi.usd",
      "display_name": "World Gold Council (live spot)",
      "price": "4726.01",
      "is_stale": false,
      "timestamp": "2026-04-27T04:47:24+00:00"
    }
    /* + cmc.paxg + cmc.xaut entries — full sources[] in live response */
  ],
  "value_stale": false,
  "price_gram_24k": "151.9447",
  "price_gram_22k": "139.2827",
  "price_gram_18k": "113.9586",
  "open_price": "4681.305",
  "high_price": "4729.56",
  "low_price": "4672.927",
  "prev_close_price": "4681.302",
  "ch": "44.6260",
  "chp": "0.9533",
  "open_time": 1777248000
}

The worksheet table will show six rows — symbol, price, bid, ask, computed_at, is_stale. Format the price column as Currency via Home → Number → Currency if you want a $ prefix.

Common errors

CodeSymptomFix
401Power Query returns DataSource.Error: 401 UnauthorizedAPI key missing or invalid. Edit the query and re-paste your key into the ApiKey parameter. If you previously stored credentials, also clear them via Data → Get Data → Data Source Settings → Clear Permissions for api.goldprice.dev.
429Sporadic DataSource.Error: 429 Too Many RequestsYou hit the per-minute cap. Power Query refreshes the entire query on each Refresh All; if you have many goldprice.dev queries open in one workbook, stagger them or upgrade — see /pricing for Basic and Pro tiers.
N/AExcel keeps prompting for credentials, or refresh fails with Please specify how to connectYou connected to the full URL instead of using RelativePath. The query above splits base URL + relative path so the credentials resolver matches one stable origin. If you skipped that, edit the query and copy the canonical version above verbatim.

FAQ

How often does the price update?

The spot endpoint refreshes every 60 seconds (Pyth + WGC + CME aggregation). Excel does not poll on its own — the table refreshes when you open the workbook, click Refresh All, or set a periodic refresh under Data → Queries & Connections → Properties.

Will this fit the free tier with auto-refresh?

Yes, comfortably. A typical workbook fires 3–5 calls/day (workbook open + a few manual refreshes). The 1,000 calls/month free tier covers ~33 calls/day. Even a workbook with a 5-minute auto-refresh schedule lands around 96 calls/day — still inside the free tier. For multi-workbook deployments, see /pricing for Basic and Pro tiers.

Does this work on Mac?

Yes. Power Query M is the canonical path on both platforms. The legacy WEBSERVICE() function is Windows-only and broken on Mac, so this tutorial avoids it. Anything you build with the M query above runs identically on macOS Excel and Windows Excel.

Can I use this commercially?

The Free tier is for personal use. For commercial use (dashboards you ship, internal reporting at work, products you sell), upgrade to Basic or Pro — see /pricing.

What metals are supported?

Gold (XAU), silver (XAG), copper (HG), platinum (XPT), palladium (XPD). Substitute the metal code in the Symbol parameter, e.g. XAG-USD-SPOT.

Is the free tier really free?

Yes — 1,000 calls/month, no credit card, no expiration. Get the key at /onboarding.

Can I have Claude write this for me?

Yes. Open Claude Desktop with the goldprice.dev MCP server installed and ask: Write a Power Query M query that calls the goldprice.dev /v1/spot endpoint with my API key in the X-API-Key header. Use RelativePath so scheduled refresh works. Return symbol, price, bid, ask, and timestamp as a table. The MCP server gives Claude access to the live schema, so the generated query uses the correct field names on first try.

Going further

  • Build a price-alert column: =IF([@price] > 4800, "ALERT", "OK")
  • Add a parameter table — store ApiKey and Symbol as named ranges so non-technical users can change inputs without editing M code
  • Track silver, copper, and gold side by side in three queries; reference them in a single dashboard sheet
  • Pull historical prices via /v1/history/XAU-USD-SPOT?days=30 for charting and backtests

Next steps

Try the same setup in a different platform:

Browse all 6 tutorials →