FormulaParser

FormulaParser

A Excel Formula Parser & Evaluator

Constructor

new FormulaParser(configopt, isTest)

Source:
Parameters:
Name Type Attributes Default Description
config Object <optional>
isTest false

is in testing environment

Members

(static) allTokens

Source:

Get all lexing token names. Webpack needs this.

Methods

_callFunction(name, args) → {*}

Source:

Call an excel function.

Parameters:
Name Type Description
name

Function name.

args

Arguments that pass to the function.

Returns:
Type
*

checkFormulaResult(result, allowReturnArrayopt) → {*}

Source:

Check and return the appropriate formula result.

Parameters:
Name Type Attributes Default Description
result
allowReturnArray boolean <optional>
false

If the formula can return an array

Returns:
Type
*

getCell(ref) → {*}

Source:

Get value from the cell reference

Parameters:
Name Type Description
ref
Returns:
Type
*

getRange(ref) → {*}

Source:

Get values from the range reference.

Parameters:
Name Type Description
ref
Returns:
Type
*

getVariable(name) → {*}

Source:

TODO: Get references or values from a user defined variable.

Parameters:
Name Type Description
name
Returns:
Type
*

parse(inputText, positionopt, allowReturnArrayopt) → {*}

Source:

Parse an excel formula.

Parameters:
Name Type Attributes Default Description
inputText string
position Object <optional>

The position of the parsed formula e.g. {row: 1, col: 1}

allowReturnArray boolean <optional>
false

If the formula can return an array. Useful when parsing array formulas, or data validation formulas.

Returns:
Type
*

(async) parseAsync(inputText, positionopt, allowReturnArrayopt) → {*}

Source:

Parse an excel formula asynchronously. Use when providing custom async functions.

Parameters:
Name Type Attributes Default Description
inputText string
position Object <optional>

The position of the parsed formula e.g. {row: 1, col: 1}

allowReturnArray boolean <optional>
false

If the formula can return an array. Useful when parsing array formulas, or data validation formulas.

Returns:
Type
*

retrieveRef(valueOrRef) → {*}

Source:

Retrieve values from the given reference.

Parameters:
Name Type Description
valueOrRef
Returns:
Type
*

supportedFunctions() → {this}

Source:

Return currently supported functions.

Returns:
Type
this