Skip to content

Range.getFormula() invalid return type #365

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Status: in backlogIssue is being tracked in the backlog but timeline for resolution is unknownType: product bugBug in the Office Scripts platform or Office Scripts APIs

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions