Skip to main content
These functions read and reshape tables. Rows and columns are 1-indexed meaning the first row and first column are index 1.

Size

Length [length]

The number of rows.

Width [width]

The number of columns.

Access

Item [item]

A single value: from the first column at index, or at the intersection of row and column. An index outside the table returns an Invalid dimensions error.

Row [row, rows]

A single row at index, or the rows from first to last inclusive. An index out of range returns an Invalid dimensions error; last less than first returns a Parameter out of range error.

Column [column, columns]

A single column at index, or the columns from first to last inclusive. Bounds behave as for row.

Subset [subset]

The rectangular region between the given rows and columns, inclusive.
lookup, vlookup, and rlookup all search one column of a table for value and then return something from the first matching row — its position, a value from another column, or the whole row.

Common parameters

All three share the same three arguments:
  • value — the value to search for.
  • the searched column — which column to look in. This is the column argument (called inputColumn in vlookup). When it is omitted, the first column is searched.
  • method — how the match is made: 0 (the default) finds an exact match, -1 finds the largest value ≤ value, and 1 finds the smallest value ≥ value. An exact-match search may be in any order; the -1 and 1 methods require the searched column to be sorted in ascending order.
The first row and column are index 1.

Lookup [lookup]

The row index (1-based) of the first row whose searched column matches value, or 0 when nothing matches — use it to find where a value sits. column selects the column to search (the first column when omitted); method controls how the match is made. Shares the value, searched-column, and method arguments — details.

Value lookup [vlookup]

The value in returnColumn from the first matching row — a spreadsheet-style lookup (find a row by one column, read a cell from another). With three arguments, value is searched in the first column; with four or more, inputColumn is the column searched and returnColumn the column read from. method controls how the match is made. No match yields a Parameter out of range error. Shares the value, searched-column, and method arguments — details.

Row lookup [rlookup]

The entire matching row, as a table — use it when you need several values from the matched row at once, rather than its position (lookup) or one cell (vlookup). value is the value to find; column selects the column to search (the first column when omitted); method controls how the match is made. No match yields a Parameter out of range error. Shares the value, searched-column, and method arguments — details.

Reshape

Sort [sort]

Sorts the rows by columns, ascending by default. Pass true for descending. All columns move together. columns is either a single column number or an array of column numbers, each 1-based. An array lists sort keys in precedence order — the first column is the primary key, the next breaks ties among rows equal on the first, and so on; rows equal on every listed column keep their original relative order. A single number is equivalent to a one-element array — 1 and [1] behave the same. descending sets one direction for the whole sort; per-column directions are not supported. A column number below 1 or greater than the table’s column count — passed directly or inside the array — returns Invalid dimensions.
With an array, ties on the primary key fall through to the next column. Here the primary key is column 2, then 3, then 1, then 4:

Append [append]

Joins table2 onto table1 as new rows by default, or as new columns when asColumns is true. Appended tables must have matching dimensions on the joining edge, or Invalid dimensions is returned.