SheetXL - v0.3.20
    Preparing search index...

    Interface IFormulaContext

    Provides the context for formula evaluation functions.

    interface IFormulaContext {
        formatResults(numFmt: string): void;
        fromOADate(oaDate: number): Date;
        getAddress(
            coords?: Readonly<IRange.FixableCoords | IRange.FixableCellCoords>,
            r1c1?: boolean,
        ): string;
        getEntireCoords(): IRange.Coords;
        getFormulaAt(row: number, column: number): string;
        getFunction(name: string): IFunction;
        getNumberFormat(formatText: string, value: Scalar): string;
        getPosition(): Readonly<IRange.CellCoords>;
        getRange(value: Scalar | Scalar[][], isLiteral?: boolean): IRange;
        getReference(
            coords: string | Readonly<IRange.Coords>,
            r1c1?: boolean,
        ): IReferenceRange<any>;
        getRuntime(): IRuntime;
        getSheetCount(): number;
        getSheetIndex(sheetName?: string): number;
        getSpillAt(row: number, column: number): IReferenceRange<Scalar>;
        getValueAt(row: number, column: number): Scalar;
        isValidDate(value: any): boolean;
        markVolatile(): void;
        parseAsDateTime(text: string, requireDate?: boolean): number;
        toOADate(date: Date): number;
    }

    Implemented by

    Index

    Methods

    • Provide a hint to the UI to format the return results.

      Parameters

      • numFmt: string

        The number format to apply to the results.

      Returns void

      • The UI will generally only format results if the user has not already formatted the area.
      • If a range is returned all values will be formatted with the same format.
    • Returns a date from an OADate value. This is used for date calculations.

      Parameters

      • oaDate: number

        A serialized date as a number.

      Returns Date

    • Returns the address of the current sheet.

      Parameters

      • Optionalcoords: Readonly<IRange.FixableCoords | IRange.FixableCellCoords>

        The coordinates to get the address for. If not provided the current position is used.

      • Optionalr1c1: boolean

        If true, the address will be in R1C1 format. Default is false (A1 format).

      Returns string

    • Returns the entire range of the sheet useful for validating range is to large.

      Returns IRange.Coords

    • Returns a formula string or null if no formula exists.

      Parameters

      • row: number

        The row where the formula is located.

      • column: number

        The column where the formula is located.

      Returns string

      The formula string at the specified row and column, or null if no formula exists.

    • Returns a function.

      Parameters

      • name: string

        The name of the function.

      Returns IFunction

      Case-insensitive

    • Returns a formatted value using the number formatting rules.

      Parameters

      • formatText: string

        The format to apply to the value.

      • value: Scalar

        The value to format.

      Returns string

      A formatted string of the value.

    • Create a range from a materialized 2D array.

      Parameters

      • value: Scalar | Scalar[][]

        The value to create a range from. This can be a single value or a 2D array.

      • OptionalisLiteral: boolean

        If true, the range will be treated as a literal value.

      Returns IRange

      An IRange representing the value.

    • Used for functions that return RangeReferences such as INDIRECT and OFFSET and SUMIF.

      Parameters

      • coords: string | Readonly<IRange.Coords>

        The coordinates or a string of the range to get.

      • Optionalr1c1: boolean

        If true, the coordinates are in R1C1 format.

      Returns IReferenceRange<any>

      An IReferenceRange representing the range.

      Error #REF! if unable to parse the range.

      • PERFORMANCE Calling this method wil create a dynamic dependency on this range if not in the original inputs.
      • It is recommended to use this sparingly.
      • If coords is a string it will be parsed but named references are not supported.
    • For introspecting the current runtime.

      Returns IRuntime

      This is generally used for debugging but the built-in INFO function also makes use of this.

    • Returns the number of sheets in the workbook.

      Returns number

    • Returns a formula string or null if no formula exists.

      Parameters

      • OptionalsheetName: string

        The name of the sheet. If not provided the current sheet is used.

      Returns number

      -1 if the sheet does not exist.

    • Returns a spill reference at a location if it exists.

      Parameters

      • row: number

        The row where the spill starts.

      • column: number

        The column where the spill starts.

      Returns IReferenceRange<Scalar>

      An IReferenceRange if a spill exists at the location, otherwise null.

    • Retrieves a value from the sheet.

      Parameters

      • row: number

        The row where the value is located.

      • column: number

        The column where the value is located.

      Returns Scalar

      The value at the specified row and column, or null if no value exists.

    • Returns true if the value is a valid date.

      Parameters

      • value: any

        Any value to check.

      Returns boolean

    • Calling this will mark the function as volatile.

      Returns void

      • Volatile functions will be re-evaluated on the next calculation.
      • Functions may also be statically marked as volatile in the engine.
    • Parsed text as a date and time.

      Parameters

      • text: string

        The text to parse as a date and time.

      • OptionalrequireDate: boolean

        If true, the text must contain a date component.

      Returns number

      The OADate value or null if the text could not be parsed.

    • Returns an OADate value from a date. This is used for date calculations.

      Parameters

      • date: Date

        A date as a javascript object.

      Returns number