Posted 23 May 2019, 2:41 am EST
Hi there,
We are seeing two issues with async formulas.
For context: we’ve created a custom async formula “DATA”. It basically takes a string parameter and goes to an API to fetch data. The resulting data is a number. This number is what the function returns.
For example: DATA(“something”) returns 1.234
We see both issues mentioned below in a clean sheet, with a single DATA(“something”) formula entered into cell 1,1
Issue one: It seems that the evaluateAsync JS function is called three times when we enter a DATA formula into a cell.
Issue two: When we load the example sheet with one populated cell from our database, our code populates the cell using the sheet.setFormula function. We confirm that the cell is populated with our DATA formula and the formula executes and returns the expected result. But the moment the evaluateAsync JS function is done, a “CellChanged” event fires, saying that the cell has been changed to the value of 1.234 (i.e., raw number, not formula). Double clicking in the cell that we just loaded we no longer see the formula, but the value 1.234. So the formula is gone.
Are we using async formulas incorrectly?
Daniel