Skip to content

Range.getFormula() invalid return type #365

Open
@zWarMob

Description

@zWarMob

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

Screenshots
image

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions