How to get live gold prices in Excel
Connect Excel to live gold prices with a downloadable setup workbook and Power Query M.
Updated
To connect Excel to goldprice.dev, download the companion workbook, add your API key and symbol to its GoldpriceSettings table, then paste the included Power Query M code into Excel for Windows. The query calls api.goldprice.dev/v1/spot/XAU-USD-SPOT. Mac users can refresh supported Power Query connections but need the connection authored in Windows because Excel for Mac does not provide the full Power Query Editor. The free tier includes 1,000 calls/month.
1.Download the Excel companion workbook
Download the goldprice.dev Excel template. It includes a Setup table, the full query as copyable text, a quota calculator, and an expected-output example. It deliberately ships with a blank API key and no live connection.
Create a free key at goldprice.dev/onboarding. The free tier needs no credit card.
Get your free API key1,000 calls/mo, no credit cardSign up free →2.Enter the key and symbol on Setup
Open the workbook and enter your key in Setup!B5. Change Setup!B6 only if you want a symbol other than
XAU-USD-SPOT. These cells form theGoldpriceSettingstable read by the query.The key remains visible in the workbook. Remove it before sharing the file, or use an organization-approved secret-management pattern.
3.Create the query in Excel for Windows
In Excel for Windows, choose Data → Get Data → From Other Sources → Blank Query, open Advanced Editor, and replace its contents with the query below. The same code is in the workbook and available as a Power Query file. Rename the query
GoldPrice.POWERQUERY · Power Query · Advanced Editorlet Settings = Excel.CurrentWorkbook(){[Name="GoldpriceSettings"]}[Content], ApiKey = Text.Trim(Text.From(Table.SelectRows(Settings, each [Setting] = "ApiKey"){0}[Value])), Symbol = Text.Upper(Text.Trim(Text.From(Table.SelectRows(Settings, each [Setting] = "Symbol"){0}[Value]))), CheckedKey = if ApiKey = "" then error "Enter your goldprice.dev API key in Setup!B5" else ApiKey, Raw = Web.Contents( "https://api.goldprice.dev", [ RelativePath = "v1/spot/" & Symbol, Headers = [#"X-API-Key" = CheckedKey] ] ), Source = Json.Document(Raw), 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 Result4.Load and refresh the result
Click Done → Close & Load. If Excel asks how to connect to
https://api.goldprice.dev, choose Anonymous; the query sends your key in the header. Refresh with Data → Refresh All.Excel for Mac can refresh supported Power Query connections created in Windows, but it does not offer the full Power Query Editor needed to author this connection. The download is a companion template, not a preconnected workbook.
5.Switch currency or metal
Change Setup!B6, then refresh. Symbols use
METAL-CURRENCY-SPOT. The query uppercases and trims the value automatically.TEXT · Setup!B6 · symbol examplesXAU-USD-SPOT XAU-INR-SPOT XAU-EUR-SPOT XAG-USD-SPOT
Expected output
The API returns this shape:
{
"symbol": "XAU",
"quote_currency": "USD",
"unit": "troy_ounce",
"contract_type": "spot",
"price": "4826.40",
"bid": "4825.91",
"ask": "4826.89",
"is_stale": false,
"computed_at": "2026-08-18T08:00:00Z"
}The loaded table shows symbol, price, bid, ask, computed_at, and is_stale. Format numeric cells as Currency if you want a currency symbol.
Common errors
| Code | Symptom | Fix |
|---|---|---|
| 401 | Power Query returns DataSource.Error: 401 Unauthorized | The key in Setup!B5 is blank or invalid. Paste a fresh key from your dashboard. If Excel cached the wrong source credentials, clear permissions for api.goldprice.dev and choose Anonymous again. |
| 429 | Sporadic DataSource.Error: 429 Too Many Requests | Power Query automatically retries a 429 response, using Retry-After when the API supplies it. If the request still fails, reduce the refresh frequency. The Setup sheet estimates monthly calls; count every query and workbook together. See pricing if the total exceeds your plan. |
| N/A | Excel for Mac does not show the full Power Query Editor | That is a platform limitation, not an API error. Author this custom M connection once in Excel for Windows, then open and refresh that connected workbook on a supported Mac version. |
FAQ
How often does the price update?
The spot endpoint can update every 60 seconds. Excel only calls it when you open the workbook, click Refresh All, or run a configured refresh.
Will this fit the free-tier quota?
The Free tier includes 1,000 calls/month. Three manual refreshes a day are about 90/month. Hourly refreshes during an 8-hour workday for 22 days are 176/month; every 15 minutes is 704/month. Every 5 minutes on that schedule is 2,112/month and exceeds Free. The workbook calculator uses the same formula.
Does this work on Mac?
Mac Excel can import and refresh supported Power Query data, but Microsoft does not provide the full Power Query Editor there. A custom M connection such as this one must first be authored in Excel for Windows; the connected workbook can then be refreshed on a supported Mac version.
Is it safe to share the workbook?
Not while your key remains in Setup!B5. Clear the cell before sending the file. The downloadable template ships with that cell blank.
Can I use this commercially?
The Free tier is for personal use. For commercial dashboards or internal reporting, use Physical ($10/mo) or Pro ($30/mo). See pricing.
What metals are supported?
Gold (XAU), silver (XAG), and copper (HG) are supported. Change the symbol in Setup!B6, for example XAG-USD-SPOT.
Can an AI assistant like Claude write this for me?
Yes. Give Claude, Cursor, or ChatGPT the goldprice.dev MCP server or llms.txt, then ask for a Power Query M query using Web.Contents, RelativePath, and the X-API-Key header. Never include your real key in the prompt.
Going further
- Build a price-alert column:
=IF([@price] > 4800, "ALERT", "OK") - Track gold and silver in separate queries, then combine them in one dashboard
- Pull recent daily bars from
/v1/barsfor a chart or backtest - Connect the refreshed price to a valuation model instead of pasting values manually
Next steps
Try the same setup in a different platform: