[Bug]: ADDRESS returns "!R2C3" when sheetName is empty (should return "R2C3")

Open Beginner friendly
#1,641 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
typescript
Domain
backend

Research direction

Start in src/interpreter/plugin/AddressPlugin.ts at line 70 and run the provided ADDRESS reproduction to confirm the current result. Exclude an empty sheetName from the separator logic, then rerun the reproduction and verify that it returns "R2C3" rather than "!R2C3".

Written by the indexing model from the issue text.

Description

Bug Impact: Low
Description

ADDRESS(2,3,1,FALSE(),) returns !R2C3 instead of R2C3.

When the sheetName argument is an empty string (either from an empty cell reference or trailing comma), HyperFormula still prepends the ! separator. Excel ignores empty sheetName and returns the address without prefix.

Root cause

In src/interpreter/plugin/AddressPlugin.ts:70, the condition:

if (sheetName !== undefined && sheetName !== null)

does not exclude empty strings. Fix: add && sheetName !== ''.

Reproduction steps
const hf = HyperFormula.buildFromArray([
  ['=ADDRESS(2,3,1,FALSE(),)'], // empty sheetName — should be "R2C3", bug: "!R2C3"
], { licenseKey: 'gpl-v3' })

hf.getCellValue({ sheet: 0, row: 0, col: 0 })
// Actual:   "!R2C3"
// Expected: "R2C3" (Excel behavior, Microsoft 365 desktop)
Excel reference

=ADDRESS(2,3,1,FALSE(),)R2C3 (Microsoft 365 desktop)

HyperFormula version

3.2.0

Your framework

No response

Your environment

Node.js

Dominant language
TypeScript
Stars
2.8k
Forks
171
Avg merge
1d 22h
Merged PRs (30d)
7

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from handsontable/hyperformula

All issues in handsontable/hyperformula

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.