Skip to content

Documentation

PHP SDK: Excel cell addresses and ranges

Get this object with $ctx->documents()->coordinates(). You do not need to create it yourself in a scenario.

columnName

columnName(int $column): string

Convert a one-based column number to letters: 1 → A, 27 → AA. The allowed range is 1–16384.

$coordinates = $ctx->documents()->coordinates();
$name = $coordinates->columnName(27);

columnNumber

columnNumber(string $column): int

Convert column letters to a one-based number. Letter case does not matter. An invalid address raises an error.

$coordinates = $ctx->documents()->coordinates();
$number = $coordinates->columnNumber('AA');

position

position(string $address): array

Convert a cell address to [row, column], both one-based. Absolute references such as $A$1 are supported. Sheet names are not accepted in the address; select the sheet with sheet() first.

$coordinates = $ctx->documents()->coordinates();
$position = $coordinates->position('AA12');

bounds

bounds(string $range): array

Convert a range to [first row, first column, last row, last column]. A single cell is allowed. A reversed range raises an error.

$coordinates = $ctx->documents()->coordinates();
$bounds = $coordinates->bounds('A2:C8');