# Javascript: TableCell.getFormula Method

> Gets the table cell's formula. For each table cell a formula can be defined which is used to calculate the cell's text. The formula can contain references to other table cells in the same table. When the text of a referenced cell changes, the cell which references it is automatically updated.

- **Product:** DS Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 28.0
- **Path:** DS Server > Reference > JavaScript API > Javascript: TableCell.getFormula Method
- **412 words**
- **Web URL:** https://docs.textcontrol.com/ds-server/reference/javascript/tablecell/getformula-method/
- **LLMs URL:** https://docs.textcontrol.com/ds-server/reference/javascript/tablecell/getformula-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/ds-server/reference/javascript/tablecell/getformula-method/llms-full.txt

---

### Description

Gets the table cell's formula. For each table cell a formula can be defined which is used to calculate the cell's text. The formula can contain references to other table cells in the same table. When the text of a referenced cell changes, the cell which references it is automatically updated.

### Syntax

```javascript
<void> TableCell.getFormula(<RequestStringCallback> callback, [<ErrorCallback> errorCallback])
```

### Parameters

| Parameter | Description |
|---|---|
| callback | Receives the cell's formula. |
| errorCallback | Optional. Is called when the operation failed with an error. |

### Examples

The following example demonstrates `TableCell.getFormula` in a practical document-editing workflow. It gets the table cell's formula. For each table cell a formula can be defined which is used to calculate the cell's text. The formula can contain references to other table cells in the same table. When the text of a referenced cell changes, the cell which references it is automatically updated.

```javascript
function onTxError(error) {
    console.error("TX Text Control error:", error.msg);
    error.handled = true;
}

function inspectFormula(tableCell) {
    tableCell.getFormula(
        function(result) {
            console.log("get formula result:", result);
        },
        onTxError
    );
}
```

---

## Nearby

- **Previous:** [Javascript: TableCell.getColumn Method](https://docs.textcontrol.com/ds-server/reference/javascript/tablecell/getcolumn-method/llms-full.txt)
- **Next:** [Javascript: TableCell.getLength Method](https://docs.textcontrol.com/ds-server/reference/javascript/tablecell/getlength-method/llms-full.txt)
