# Cell Execution

Spreadsheet works similarly to other spreadsheet applications in terms of its standard operations and functionality, such as manipulating blocks of cells, editing cells, referencing cells and inserting functions. Spreadsheet is organized into a table of cells arranged in 400 rows (numbered 0 to 399) and 26 columns (labeled A to Z), each cell is identified by its column letter and row number. For example, cell A2 is located at the intersection of column A and row 2.

You can configure Spreadsheet one cell at a time. The contents of each cell are expressed as a formula, and any piece of information you insert into a cell, whether a simple numerical value or a complex vision processing function, is considered a part of the formula. When you highlight a cell, it becomes outlined in black and the information in the cell is displayed in the Formula Bar above the Spreadsheet.

Clicking on a cell automatically makes it the active cell, highlighting the cell and the associated row and column headers. For example, in the following spreadsheet, B2 is the active cell and is outlined in black. The headers of both the active column (B) and the active row (2) are highlighted in yellow to indicate the address of the active cell.

Tip: Right-clicking on a Spreadsheet cell displays a shortcut menu that allows you to perform various operations. For more information, see Right-Click Menu.

## Cell Dependencies

As with other conventional spreadsheets, the execution order of the cells in Spreadsheet is dynamically determined by the relationship and dependencies between cell functions. The In-Sight spreadsheet determines the order of cell execution primarily by evaluating cells according to their dependencies, and secondarily by their locations within the spreadsheet.

To visualize dependencies for the highlighted cell in Spreadsheet, use the Dependency Levels buttons in the Spreadsheet toolbar.

## Order of Cell Execution

After dependencies have been evaluated, the cells are evaluated by their location within the spreadsheet. Cells are sorted by their row-coordinate from left to right, and then by their column-coordinate from top to bottom. For example, in a Spreadsheet job with functions in the A2, B2, A3, and A4 cells, the first cell to execute is A2, followed by cells B2, A3, and then A4. If multiple cells exist in the same row, then the left-most cell is executed first.

The following are exceptions to normal cell execution order:

- Clocked functions: In the execution tree, clocked functions are always placed at the top of the execution chain because they need to access the old data in the other cells. For more information, see Clocked Data Storage Functions.
- Functions with non-dependency cell references: Several functions take cell references as arguments but do not establish any dependencies. The Row function, which returns the row coordinate of the referenced cell, is one of these functions. For example, Row(A4) always returns 4, even if the value in A4 changes.

## Cell Execution Triggers

Cells are executed when:

- A cell that has dependents has been modified.
- External events occur, such as AcquireImage triggers, serial data, and incoming packets to TCPDevice.
- Graphics Controls (such as Button, Checkbox, EditInt) signal a spreadsheet Event trigger.

Most Vision Tool functions depend either directly or indirectly on the Image data in cell A1. When a new image is acquired, all functions in the dependency chain execute and return new values. Spreadsheet automatically updates when an image acquisition or other Event is triggered.