Open
Description
Article URL
ExcelScript.Range interface - getFormula()
Describe the problem
Documentation (and the interface itself) suggests getFormula() is supposed to return a string.
Not the case.. getFormula() behaves like getValue() and can return non-string values
let sheet = workbook.getWorksheet("Env.data");
[ . . . ]
let aQ = sheet .getCell(1, 1);
let qFormula: string = aQ.getFormula();
try{
qFormula = qFormula.startsWith('=') ? qFormula.slice(1) : qFormula;
}catch(e){
console.log(typeof(qFormula));
console.log(qFormula);
throw e;
}
logs and error:
number
0
qFormula.startsWith is not a function