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/AUDand returns the current GoldAPI.io price value.
functions.tscontains the custom function implementation.functions.jsoncontains static custom functions metadata for theGOLDPRICEfunction.
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.
After the add-in is sideloaded or deployed, use:
=GOLDPRICE("XAU","AUD")
You can request a different pair:
=GOLDPRICE("XAG","USD")
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.