I am building out an Excel add-in custom function and I'm struggling to figure out how to add environment variables to my project. Based on my research we don't have access to the manifest file at runtime and we also don't have access to environment variables (e.g. NODE_ENV) because the code runs within Excel. Reading through the documentation I can't seem to find any details on how we would handle environment variables in the code. How can I use environment variables in my code?
In this example, my baseUrl
should change based on the environment I am in.
/**
* Returns price.
* @customfunction PRICE
* @param {string} symbol
* @returns string
*/
export async function price(symbol: string): Promise<string> {
try {
const url = `${baseUrl}/api/${symbol}`;
const response = await axios.get(url);
return response.data[0].symbol;
} catch (err) {
return err.message;
}
}