OfficeDev / OfficeDev/office-scripts-docs-reference
Range.getFormula() invalid return type
Open
@alison-mk is already working on this.
Since Oct 17, 2024.
Status: in backlog
Type: product bug
- Dominant language
- TypeScript
- Stars
- 71
- Forks
- 36
- Avg merge
- 4d 14h
- Merged PRs (30d)
- 12
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
Screenshots
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.