1

I'm using Office JS framework to get data from a REST API server endpoint using "Custom Function" in Excel(part of Office 365). I'm using the YO generator mentioned in the tutorials(https://learn.microsoft.com/en-us/office/dev/add-ins/quickstarts/excel-custom-functions-quickstart?tabs=excel-windows) I created a custom function which would call REST endpoint to get the data and the result will be placed in the cell. I used same function in multiple cells to get the data. After a threshold number of consecutive calls VALUE! error is returned in the cell. If I recalculate the VALUE! errored cell, it will return the data.

Please help me resolve this issue.

How to reproduce:

  1. Create Custom function project using the tutorial(https://learn.microsoft.com/en-us/office/dev/add-ins/quickstarts/excel-custom-functions-quickstart?tabs=excel-windows) and select language Typescript.

  2. Add following function to the \src\functions\functions.ts file.

  /**
   * Loads data from REST test service.
   * @customfunction TEST_REST_CALL
   * @param id ID
   * @returns response data.
   */
  export async function testRestCall(id: number) {
    var response = await fetch(`https://jsonplaceholder.typicode.com/posts/${id}`);
    var data = await response.json();
    return data.title;
  }
  1. Use the function "TEST_REST_CALL(2)" in no less than 1000 cells.

You will get following VALUE! error for some of the cells.

Excel result

Rick Kirkham
  • 9,038
  • 1
  • 14
  • 32

0 Answers0