java.lang.Object
org.apache.poi.ss.formula.functions.Sheet
All Implemented Interfaces:
FreeRefFunction

public class Sheet extends Object implements FreeRefFunction
Implementation for Excel SHEET() function.

Syntax:
SHEET([value])

Returns the sheet number of the referenced sheet or the current sheet if no argument is provided.

Examples:

  • =SHEET() → returns the current sheet number (1-based)
  • =SHEET(A1) → returns the sheet number of the reference A1
  • =SHEET(A1:B5) → returns the sheet number of the range A1:B5
  • =SHEET("Sheet3") → returns the sheet number of the sheet named "Sheet3"

See Microsoft Documentation

  • Field Details

    • instance

      public static final Sheet instance
  • Constructor Details

    • Sheet

      public Sheet()
  • Method Details

    • evaluate

      public ValueEval evaluate(ValueEval[] args, OperationEvaluationContext ec)
      Specified by:
      evaluate in interface FreeRefFunction
      Parameters:
      args - the pre-evaluated arguments for this function. args is never null, nor are any of its elements.
      ec - primarily used to identify the source cell containing the formula being evaluated. may also be used to dynamically create reference evals.
      Returns:
      never null. Possibly an instance of ErrorEval in the case of a specified Excel error (Exceptions are never thrown to represent Excel errors).