2

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;
  }
}
Rick Kirkham
  • 9,038
  • 1
  • 14
  • 32
Tim Hutchison
  • 3,483
  • 9
  • 40
  • 76

1 Answers1

-1

Thanks for your question. But I'm afraid that this is not supported by now.

Maybe you can share more details about your scenario so that another option might be considered.

Xiangmin
  • 1
  • 2