---
title: Formulas
metaTitle: Formulas - Plugin - Handsontable Documentation
permalink: /9.0/api/formulas
canonicalUrl: /api/formulas
editLink: false
---

# Formulas

[[toc]]

## Description

This plugin allows you to perform Excel-like calculations in your business applications. It does it by an
integration with our other product, [HyperFormula](https://github.com/handsontable/hyperformula/), which is a
powerful calculation engine with an extensive number of features.


## Options

### formulas
  
::: source-code-link https://github.com/handsontable/handsontable/blob/4d56e68f9cb6412b841663278b2e0eb3ad181233/src/dataMap/metaManager/metaSchema.js#L2765

:::

_formulas.formulas : boolean | object_

The [Formulas](@/api/formulas.md) plugin allows Handsontable to process formula expressions defined in the provided data.

**Default**: <code>undefined</code>  
**Example**  
```js
// in Handsontable's `formulas` configuration option, add the `HyperFormula` class
formulas: {
  engine: HyperFormula,
  // the `Formulas` plugin configuration
}

// or, add a HyperFormula instance
const hyperformulaInstance = HyperFormula.buildEmpty({})

formulas: {
  engine: hyperformulaInstance,
  // the `Formulas` plugin configuration
}

// use the same HyperFormula instance in multiple Handsontable instances

// a Handsontable instance `hot1`
formulas: {
  engine: HyperFormula,
  // the `Formulas` plugin configuration
}

// a Handsontable instance `hot2`
formulas: {
  engine: hot1.getPlugin('formulas').engine,
  // the `Formulas` plugin configuration
}
```

## Members

### engine
  
::: source-code-link https://github.com/handsontable/handsontable/blob/4d56e68f9cb6412b841663278b2e0eb3ad181233/src/plugins/formulas/formulas.js#L95

:::

_formulas.engine : HyperFormula | null_

The engine instance that will be used for this instance of Handsontable.



### sheetId
  
::: source-code-link https://github.com/handsontable/handsontable/blob/4d56e68f9cb6412b841663278b2e0eb3ad181233/src/plugins/formulas/formulas.js#L109

:::

_formulas.sheetId : number | null_

HyperFormula's sheet id.



### sheetName
  
::: source-code-link https://github.com/handsontable/handsontable/blob/4d56e68f9cb6412b841663278b2e0eb3ad181233/src/plugins/formulas/formulas.js#L102

:::

_formulas.sheetName : string | null_

HyperFormula's sheet name.


## Methods

### addSheet
  
::: source-code-link https://github.com/handsontable/handsontable/blob/4d56e68f9cb6412b841663278b2e0eb3ad181233/src/plugins/formulas/formulas.js#L306

:::

_formulas.addSheet([sheetName], [sheetData]) ⇒ boolean | string_

Add a sheet to the shared HyperFormula instance.


| Param | Type | Description |
| --- | --- | --- |
| [sheetName] | `string` <br/> `null` | `optional` The new sheet name. If not provided (or a null is passed), will be auto-generated by HyperFormula. |
| [sheetData] | `Array` | `optional` Data passed to the shared HyperFormula instance. Has to be declared as an array of arrays - array of objects is not supported in this scenario. |


**Returns**: `boolean` | `string` - `false` if the data format is unusable or it is impossible to add a new sheet to the
engine, the created sheet name otherwise.  

### destroy
  
::: source-code-link https://github.com/handsontable/handsontable/blob/4d56e68f9cb6412b841663278b2e0eb3ad181233/src/plugins/formulas/formulas.js#L226

:::

_formulas.destroy()_

Destroys the plugin instance.



### disablePlugin
  
::: source-code-link https://github.com/handsontable/handsontable/blob/4d56e68f9cb6412b841663278b2e0eb3ad181233/src/plugins/formulas/formulas.js#L181

:::

_formulas.disablePlugin()_

Disables the plugin functionality for this Handsontable instance.



### enablePlugin
  
::: source-code-link https://github.com/handsontable/handsontable/blob/4d56e68f9cb6412b841663278b2e0eb3ad181233/src/plugins/formulas/formulas.js#L127

:::

_formulas.enablePlugin()_

Enables the plugin functionality for this Handsontable instance.



### getCellType
  
::: source-code-link https://github.com/handsontable/handsontable/blob/4d56e68f9cb6412b841663278b2e0eb3ad181233/src/plugins/formulas/formulas.js#L365

:::

_formulas.getCellType(row, column, [sheet]) ⇒ string_

Get the cell type under specified visual coordinates.


| Param | Type | Description |
| --- | --- | --- |
| row | `number` | Visual row index. |
| column | `number` | Visual column index. |
| [sheet] | `number` | `optional` The target sheet id, defaults to the current sheet. |


**Returns**: `string` - Possible values: 'FORMULA' | 'VALUE' | 'MATRIX' | 'EMPTY'.  

### isEnabled
  
::: source-code-link https://github.com/handsontable/handsontable/blob/4d56e68f9cb6412b841663278b2e0eb3ad181233/src/plugins/formulas/formulas.js#L119

:::

_formulas.isEnabled() ⇒ boolean_

Checks if the plugin is enabled in the handsontable settings. This method is executed in [Hooks#beforeInit](@/api/pluginHooks.md#beforeinit)
hook and if it returns `true` than the [Formulas#enablePlugin](@/api/formulas.md#enableplugin) method is called.



### isFormulaCellType
  
::: source-code-link https://github.com/handsontable/handsontable/blob/4d56e68f9cb6412b841663278b2e0eb3ad181233/src/plugins/formulas/formulas.js#L381

:::

_formulas.isFormulaCellType(row, column, [sheet]) ⇒ boolean_

Returns `true` if under specified visual coordinates is formula.


| Param | Type | Description |
| --- | --- | --- |
| row | `number` | Visual row index. |
| column | `number` | Visual column index. |
| [sheet] | `number` | `optional` The target sheet id, defaults to the current sheet. |



### switchSheet
  
::: source-code-link https://github.com/handsontable/handsontable/blob/4d56e68f9cb6412b841663278b2e0eb3ad181233/src/plugins/formulas/formulas.js#L341

:::

_formulas.switchSheet(sheetName)_

Switch the sheet used as data in the Handsontable instance (it loads the data from the shared HyperFormula
instance).


| Param | Type | Description |
| --- | --- | --- |
| sheetName | `string` | Sheet name used in the shared HyperFormula instance. |


