Skip to content

Latest commit

 

History

History
50 lines (31 loc) · 1.18 KB

File metadata and controls

50 lines (31 loc) · 1.18 KB

GoldAPI.io Excel Custom Function

This example shows the custom function code for an Excel Office Add-in that exposes:

=GOLDPRICE("XAU","AUD")

The function calls:

https://www.goldapi.io/api/XAU/AUD

and returns the current GoldAPI.io price value.

Files

  • functions.ts contains the custom function implementation.
  • functions.json contains static custom functions metadata for the GOLDPRICE function.

Token Setup

The function reads the GoldAPI.io token from Office add-in storage:

await OfficeRuntime.storage.setItem("GOLD_API_TOKEN", "your_goldapi_token_here");

In a production add-in, set this value from a task pane settings screen instead of hard-coding it in the custom function source.

Function

After the add-in is sideloaded or deployed, use:

=GOLDPRICE("XAU","AUD")

You can request a different pair:

=GOLDPRICE("XAG","USD")

Notes

Excel custom functions run in an Office Add-in runtime. These files are source examples for an add-in project, not standalone workbook macros.

Do not put private GoldAPI.io tokens directly into worksheet formulas. Formulas are easy to expose when a workbook is shared.