OilPrice Excel add-in · preview

Oil Prices in Excel, as Refreshable Formulas

The OilPrice add-in puts the latest Brent, WTI, natural gas, diesel and other energy prices in a cell with =OILPRICE.PRICE("BRENT_CRUDE_USD"), and the value updates when the workbook recalculates.

OilPriceAPI prices with Excel Power Query

If you already use Power Query, create a text parameter namedOilPriceAPIKeyin Manage Parameters, then paste this M query into a blank query's Advanced Editor. Choose Anonymous for the web source credential: the request itself carries your API token.

let
  Source = Json.Document(Web.Contents(
    "https://api.oilpriceapi.com",
    [RelativePath = "v1/prices/latest",
     Query = [by_code = "BRENT_CRUDE_USD"],
     Headers = [Authorization = "Token " & OilPriceAPIKey]]
  )),
  Prices = Table.FromRecords({Source[data]})
in
  Prices

The response includes the price and its source timestamp. Power Query parameters can be retained with a workbook; do not share a workbook containing your API key. The add-in above stores the key outside the worksheet and is the simpler option for refreshable formulas. Dataset access still depends on your account plan.

Quick start on Mac Excel

  1. Create a free account and copy an API key from the dashboard.
  2. Run this in Terminal, then restart Excel:
    mkdir -p ~/Library/Containers/com.microsoft.Excel/Data/Documents/wef && curl -fsSL https://oilpriceapi.github.io/excel-energy-addin/manifest.xml -o ~/Library/Containers/com.microsoft.Excel/Data/Documents/wef/oilprice-manifest.xml
  3. In Excel, open Insert > My Add-ins, choose the OilPrice developer add-in and open the OilPrice pane. Paste your key, save it and choose Test Key.
  4. Type =OILPRICE.PRICE("BRENT_CRUDE_USD") in any cell.

On Excel on the web or Windows, follow the install guide; those paths are unverified preview for now. The add-in is not yet listed in Microsoft AppSource.

Live example

This is the value the formula returns right now.

In a cell

=OILPRICE.PRICE("BRENT_CRUDE_USD")

Latest BRENT_CRUDE_USD from the API

$97.97per barrel

As of 2026-11-06 22:59 UTC

PRICE returns the number only. Put =OILPRICE.INFO("BRENT_CRUDE_USD") next to it to keep the source timestamp in the sheet.

Formulas

FormulaReturns
=OILPRICE.PRICE("BRENT_CRUDE_USD")Latest price as a plain number you can calculate with
=OILPRICE.INFO("BRENT_CRUDE_USD")Price, currency, unit, source, source timestamp and freshness
=OILPRICE.STATUS("BRENT_CRUDE_USD")Freshness state reported by the API
=OILPRICE.UNIT("BRENT_CRUDE_USD")Currency and unit
=OILPRICE.GET("/v1/prices/latest", "by_code=WTI_USD")A table from an allowlisted read-only endpoint
=OILPRICE.CODES()The commodity codes your API key can read

Platform status

Excel for Mac

Verified

Excel 16.110.2 passed sideload, key save and test, formulas, recalculation and diagnostics on 2026-07-03.

Excel on the web

Unverified

Install by uploading the manifest; no runtime smoke is recorded yet.

Excel desktop on Windows

Unverified

Install through Microsoft 365 admin or a shared-folder catalog; no runtime smoke is recorded yet.

Step-by-step guide: how to get oil prices in Excel. Troubleshooting: Excel add-in support.

Frequently asked questions

How do I get live oil prices in Excel?

Install the OilPrice add-in, save your OilPriceAPI key in its pane, then type =OILPRICE.PRICE("BRENT_CRUDE_USD") in a cell. Swap the code for WTI_USD, NATURAL_GAS_USD, DIESEL_USD or any code from =OILPRICE.CODES(). The cell updates when Excel recalculates.

Is the add-in in Microsoft AppSource?

No. The add-in is a preview and is not yet listed in Microsoft AppSource. You install it by loading its manifest file, which the install guide walks through for each platform.

Which versions of Excel does it work on?

Excel for Mac is verified: version 16.110.2 passed a recorded runtime smoke on 2026-07-03. Excel on the web and Excel desktop on Windows have install paths, but no runtime smoke is recorded for them yet, so treat them as unverified preview.

Do I need an API key?

Yes. The add-in calls the OilPriceAPI REST API with your key. A free key includes 50 requests per day; dataset and endpoint access depend on your plan.

Where is my API key stored?

In the add-in's own storage (OfficeRuntime.storage), not in a worksheet cell.

Why use INFO instead of PRICE?

PRICE returns a bare number so it works inside other formulas. INFO adds the source and source timestamp, which tells you how current the number is. Markets publish on different schedules, so check the timestamp before treating a value as current.

What does a formula show when something goes wrong?

A readable error in the cell instead of a wrong number: for example #AUTH_REQUIRED when no key is saved, #UPGRADE_REQUIRED when the dataset is not on your plan, #RATE_LIMITED with a retry time, and #NO_DATA when the API has no value.

Put the latest oil price in your workbook

Create a free key, install the add-in and type one formula.

Get free API key