# Cells

## CalculateCellFormula

Calculates the formula of the cell.

#### Syntax

```yaml
Void CalculateCellFormula(
    CellsCell Cell
)
```

#### Parameters

***Cell***\
The cell which contains the formula to calculate.\
Type: CellsCell

#### Return Type

Void

## CalculateWorkbookFormula

Calculates all formulas in the workbook.

#### Syntax

```yaml
Void CalculateWorkbookFormula(
    CellsWorkbook Workbook
)
```

#### Parameters

***Workbook***\
The workbook which contains the formulas to calculate.\
Type: CellsWorkbook

#### Return Type

Void

## CalculateWorksheetFormula

Calculates all formulas in the worksheet.

#### Syntax

```yaml
Void CalculateWorksheetFormula(
    CellsWorksheet Worksheet
)
```

#### Parameters

***Worksheet***\
The worksheet which contains the formulas to calculate.\
Type: CellsWorksheet

#### Return Type

Void

## CreateWorkspace

Creates and returns a new workbook. The workbook has the following fields (accessible through GetValue/ SetValue):

* Worksheets as List (Get)

  Warning: The return value is not serializable (causes input request errors)!

#### Syntax

```yaml
CellsWorkbook CreateWorkbook()
```

#### Parameters

*This action does not have any parameter.*

#### Return Type

CellsWorkbook

## LoadWorkbook

Loads and returns an existing workbook. The workbook has the following fields (accessible through GetValue/ SetValue):

* Worksheets as List (Get)

  Warning: The return value is not serializable (causes input request errors)!

#### Syntax

```yaml
CellsWorkbook LoadWorkbook( Document [, Format ] )
```

#### Parameters

***Format as String (optional):***\
The format of the workbook: Xls, Xlsx. Analyses the given document if format is omitted.

**Workbook**\
The document to load the workbook from.\
Type: Document

***Format*** (optional)\
The format of the workbook. Analyses the given document if format is omitted.\
Type: String

#### Return Type

CellsWorkbook

## SaveWorkbook

Saves a workbook and returns it as a document.

#### Syntax

```yaml
Document SaveWorkbook(
    CellsWorkbook Workbook,
    String Name,
    String Format
)
```

#### Parameters

***Workbook***\
The workbook to save.\
Type: CellsWorkbook

***Name***\
The name of the document.\
Type: String

***Format***\
The format of the workbook: Xls, Xlsx.\
Type: String

#### Return Type

Document

## InsertWorksheets

Inserts worksheets into a workbook.

#### Syntax

```yaml
Void InsertWorksheets(
    CellsWorkbook Workbook,
    Int [Index],
    Int [Count]
)
```

#### Parameters

***Workbook***\
The workbook to insert the worksheets into.\
Type: CellsWorkbook

***Index** (optional)*\
The insertion index of the worksheets (default 0).\
Type: Int

***Count** (optional)*\
The amount of worksheets to insert (default 1).\
Type: Int

## GetWorksheetByIndex

Gets a worksheet by index. The worksheet has the following fields (accessible through GetValue/SetValue):

* DisplayRightToLeft as Boolean (Get/ Set)
* DisplayZeros as Boolean (Get/ Set)
* FirstVisibleColumn as Int (Get/ Set)
* FirstVisibleRow as Int (Get/ Set)
* Index as Int (Get)
* IsSelected as Boolean (Get/ Set)
* IsVisible as Boolean (Get/ Set)
* Name as String (Get/ Set)
* TabColor as String (Get/ Set): HTML color (e.g. #FFFFFF)

{% hint style="warning" %}
The return value is not serializable (causes input request errors)!
{% endhint %}

#### Syntax

```yaml
CellsWorksheet GetWorksheetByIndex(
    CellsWorkbook Workbook,
    Int Index
)
```

#### Parameters

***Workbook***\
The workbook to get the worksheet from.\
Type: CellsWorkbook

***Index***\
The index of the worksheet.\
Type: Int

#### Return Type

CellsWorksheet

## GetWorksheetByName

Gets a worksheet by name. The worksheet has the following fields (accessible through GetValue/ SetValue):

* DisplayRightToLeft as Boolean (Get/ Set)
* DisplayZeros as Boolean (Get/ Set)
* FirstVisibleColumn as Int (Get/ Set)
* FirstVisibleRow as Int (Get/ Set)
* Index as Int (Get)
* IsSelected as Boolean (Get/ Set)
* IsVisible as Boolean (Get/ Set)
* Name as String (Get/ Set)
* TabColor as String (Get/ Set): HTML color (e.g. #FFFFFF)

{% hint style="warning" %}
The return value is not serializable (causes input request errors)!
{% endhint %}

#### Syntax

```yaml
CellsWorksheet GetWorksheetByName(
    CellsWorkbook Workbook,
    String Name
)
```

#### Parameters

***Workbook***\
The workbook to get the worksheet from.\
Type: CellsWorkbook

***Name***\
The name of the worksheet.\
Type: String

**Return Type**

CellsWorksheet

## RemoveWorksheets

Removes worksheets in a workbook.

#### Syntax

```yaml
Void RemoveWorksheets(
    CellsWorkbook Workbook,
    Int Index,
    Int [Count]
)
```

#### Parameters

***Workbook***\
The workbook to remove the worksheets from.\
Type: CellsWorkbook

***Index***\
The starting index of the removal.\
Type: Int

***Count** (optional)*\
The amount of worksheets to remove (default 1).\
Type: Int

#### Return Type

Void

## CellsStyle

Creates a new style. The style has the following fields (accessible through GetValue/ SetValue):

* BorderAll as CellsBorder (Set)
* BorderOutline as CellsBorder (Set)
* BorderInside as CellsBorder (Set)
* BorderLeft as CellsBorder (Get/ Set)
* BorderRight as CellsBorder (Get/ Set)
* BorderTop as CellsBorder (Get/ Set)
* BorderBottom as CellsBorder (Get/ Set)
* BorderDiagonalDown as CellsBorder (Get/ Set)
* BorderDiagonalUp as CellsBorder (Get/ Set)
* BorderVertical as CellsBorder (Get/ Set)
* BorderHorizontal as CellsBorder (Get/ Set)
* FillColor as String (Get/ Set): HTML color (e.g. #FFFFFF)
* FontColor as String (Get/ Set): HTML color (e.g. #FFFFFF)
* FontIsBold as Boolean (Get/ Set)
* FontIsItalic as Boolean (Get/ Set)
* FontIsStrikeout as Boolean (Get/ Set)
* FontIsSuperscript as Boolean (Get/ Set)
* FontIsSubscript as Boolean (Get/ Set)
* FontUnderline  as String (Get/ Set): Single, Double, Accounting, DoubleAccounting
* FontName as String (Get/ Set)
* FontSize as Int (Get/ Set)
* HorizontalAlignment as String (Get/ Set): Bottom, Center, Distributed, Fill, General, Justify, Left, Right and Top
* IsLocked as Boolean (Get/ Set)
* IsTextWrapped as Boolean (Get/ Set)
* Name as String (Get/ Set)
* Number as Int (Get/ Set)
* ShrinkToFit as Boolean (Get/ Set)
* TextDirection as String (Get/ Set): Context, LeftToRight and RightToLeft
* VerticalAlignment as String (Get/ Set): Bottom, Center, Distributed, Fill, General, Justify, Left, Right and Top

{% hint style="warning" %}
The return value is not serializable (causes input request errors)!
{% endhint %}

#### Syntax

```yaml
CellsStyle CellsStyle()
```

#### Parameters

*This action does not have any parameter*

#### Return Type

CellsStyle

## CellsBorder

Creates a new border. The border has the following fields (accessible through GetValue/ SetValue):

* Color as String (Get/ Set): HTML color (e.g. #FFFFFF)
* LineStyle as String (Get/ Set): Thin, Medium, Dashed, Dotted, Thick, Double, Hair, MediumDashed, DashDot, MediumDashDot, DashDotDot, MediumDashDotDot and SlantedDashDot

{% hint style="warning" %}
The return value is not serializable (causes input request errors)!
{% endhint %}

#### Syntax

```yaml
CellsBorder CellsBorder()
```

#### Parameters

*This action does not have any parameter*

#### Return Type

CellsBorder

## ReadColumn

Reads data from a column.

#### Syntax

```yaml
List<Any> ReadColumn(
    CellsWorksheet Worksheet,
    Int ColumnIndex,
    Int [RowIndex],
    Int [RowCount]
)
```

#### Parameters

***Worksheet***\
The worksheet with the column to read from.\
Type: CellsWorksheet

***ColumnIndex***\
The column index to read from.\
Type: Int

***RowIndex** (optional)*\
The starting row index (default 0).\
Type: Int

***RowCount** (optional)*\
The amount of rows to read from (default all upon an empty row).\
Type: Int

#### Return Type

List\<Any>

## ReadWorksheet

Reads data from a worksheet. The first row must contain the data field names.

#### Syntax

```yaml
List<Dictionary<String,Any>> ReadWorksheet(
    CellsWorksheet Worksheet,
    Int [RowIndex],
    Int [ColumnIndex],
    Int [RowCount],
    Int [ColumnCount]
)
```

#### Parameters

***Worksheet***\
The worksheet to read from.\
Type: CellsWorksheet

***RowIndex** (optional)*\
The starting row index (default 0). The first row must contain the field names.\
Type: Int

***ColumnIndex** (optional)*\
The starting column index (default 0).\
Type: Int

***RowCount** (optional)*\
The amount of rows to read from (default all upon an empty row).\
Type: Int

***ColumnCount** (optional)*\
The amount of columns to read from (default all upon an empty column).\
Type: Int

#### Return Type

List\<Dictionary\<String,Any>>

## ReadRow

Reads data from a row.

#### Syntax

```yaml
List<Any> ReadRow(
    CellsWorksheet Worksheet,
    Int RowIndex,
    Int [ColumnIndex],
    Int [ColumnCount]
)
```

#### Parameters

***Worksheet***\
The worksheet with the row to read from.\
Type: CellsWorksheet

***RowIndex***\
The row index to read from.\
Type: Int

***ColumnIndex** (optional)*\
The starting column index (default 0).\
Type: Int

***ColumnCount** (optional)*\
The amount of columns to read from (default all upon an empty column).\
Type: Int

#### Return Type

List\<Any>

## GetCellByIndex

Gets a cell by row and column index. The cell has the following fields (accessible through GetValue/SetValue):

* Column as CellsColumn (Get)
* Formula as String (Get/ Set)
* HtmlString as String (Get/ Set)
* IsErrorValue as Boolean (Get)
* IsFormula as Boolean (Get)
* IsMerged as Boolean (Get)
* Name as String (Get)
* Row as CellsRow (Get)
* Style as CellsStyle (Get/ Set)
* Value as Any (Get/ Set)

{% hint style="warning" %}
The return value is not serializable (causes input request errors)!
{% endhint %}

#### Syntax

```yaml
CellsCell GetCellByIndex(
    CellsWorksheet Worksheet,
    Int RowIndex,
    Int ColumnIndex
)
```

#### Parameters

***Worksheet***\
The worksheet to get the cell from.\
Type: CellsWorksheet

**RowIndex**\
The index of the row.\
Type: Int

***ColumnIndex***\
The index of the column.\
Type: Int

#### Return Type

CellsCell

## GetCellByName

Gets a cell by name (e.g. A1 or Z5). The cell has the following fields (accessible through GetValue/SetValue):

* Column as CellsColumn (Get)
* Formula as String (Get/ Set)
* HtmlString as String (Get/ Set)
* IsErrorValue as Boolean (Get)
* IsFormula as Boolean (Get)
* IsMerged as Boolean (Get)
* Name as String (Get)
* Row as CellsRow (Get)
* Style as CellsStyle (Get/ Set)
* Value as Any (Get/ Set)

{% hint style="warning" %}
The return value is not serializable (causes input request errors)!
{% endhint %}

#### Syntax

```yaml
CellsCell GetCellByName(
    CellsWorksheet Worksheet,
    String Name
)
```

#### Parameters

***Worksheet***\
The worksheet to get the cell from.\
Type: CellsWorksheet

***Name***\
The name of the cell (e.g. A1 or Z5).\
Type: String

#### Return Type

CellsCell

## MergeCells

Merges cells identified by range.

#### Syntax

```yaml
Void MergeCells(
    CellsWorksheet Worksheet,
    Int RowIndex,
    Int ColumnIndex,
    Int RowCount,
    Int ColumnCount
)
```

#### Parameters

***Worksheet***\
The worksheet where to merge the cells.\
Type: CellsWorksheet

***RowIndex***\
The index of the starting row.\
Type: Int

***ColumnIndex***\
The index of the starting column.\
Type: Int

***RowCount***\
The amount of rows to merge.\
Type: Int

***ColumnCount***\
The amount of columns to merge.\
Type: Int

#### Return Type

Void

## UnmergeCells

Unmerges cells identified by range.

#### Syntax

```yaml
Void UnmergeCells(
    CellsWorksheet Worksheet,
    Int RowIndex,
    Int ColumnIndex,
    Int RowCount,
    Int ColumnCount
)
```

**Parameters**

***Worksheet***\
The worksheet where to unmerge the cells.\
Type: CellsWorksheet

***RowIndex***\
The index of the starting row.\
Type: Int

***ColumnIndex***\
The index of the starting column.\
Type: Int

***RowCount***\
The amount of rows to unmerge.\
Type: Int

***ColumnCount***\
The amount of columns to unmerge.\
Type Int

**Return Type**

Void


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tivity.one/building-an-application/execution/scripting/functions/cells.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
