Skip to content

Conversation

@Rokko11
Copy link

@Rokko11 Rokko11 commented May 5, 2025

This pull request adds support for the Excel SHEET function.

Summary of changes:

Implemented org.apache.poi.ss.formula.functions.Sheet as a FreeRefFunction
Correctly resolves:

  • SHEET() → returns the current sheet index (1-based)
  • SHEET(reference) → returns the sheet index of the referenced cell or area
  • SHEET(name) → returns the sheet index of the referenced named sheet
  • Added argument validation and fallback to #NV error for invalid inputs

Motivation:

Currently I get a NotImplementedFunctionException when an Excel file contains the SHEET function and gets processed with POI. Since there is no other way to hook (yet) unsupported functions into poi, I'll need to go over a Pull Request.

@Rokko11
Copy link
Author

Rokko11 commented May 5, 2025

Sorry I didn't reopen the other PR and started a new one instead. Won't happen again.

@pjfanning
Copy link
Member

I'll get around to reviewing this in the next few days.
I have made changes already to support registering functions but allowing the checks to be skipped so that users can register what they like. The changes are incomplete but the main change is cdcc14d)
CI Builds are done nightly (including downloadable jars) - https://ci-builds.apache.org/job/POI/job/POI-DSL-1.8/

@asfgit asfgit closed this in 9f43059 May 10, 2025
@pjfanning
Copy link
Member

thanks - merged

@Rokko11
Copy link
Author

Rokko11 commented May 10, 2025

Thanks for approving and merging.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants