I am currently developing an Excel add-in custom function and I find myself facing a challenge in incorporating environment variables into my project. It seems that accessing the manifest file during runtime is not feasible, and using common environment variables like NODE_ENV is not possible as well because the code executes within Excel. The documentation doesn't provide much guidance on how to handle environment variables in this scenario. So, my question is: How can I effectively utilize environment variables in my code?
For instance, I need the baseUrl
to vary depending on the specific environment.
/**
* 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;
}
}