Skip to main content

Module addr

Module addr 

Source
Expand description

Cell and range addresses.

Internally rows and columns are 0-based (A1 = row 0, col 0). The sheet is 1,048,576 rows by 16,384 columns (XFD1048576), like Excel.

Structs§

CategoryLevels
The shape of a chart’s category range beside its values: a plain list, or a multi-level axis (Excel: a category range two or more columns wide beside a column of values is a two-level axis, year beside month; one two or more rows tall above a row of values likewise).
CellRef
A cell position (0-based).
RangeRef
A rectangular block of cells, inclusive on both ends. Always normalised (start <= end).

Constants§

MAX_COLS
MAX_ROWS

Functions§

category_levels
How categories lays its labels out beside values (None when the values aren’t a reference: the categories’ own shape decides). None for a plain list of labels.
col_to_letters
0 → A, 25 → Z, 26 → AA, 16383 → XFD.
letters_to_col
A → 0, xfd → 16383. None for empty, non-letters or beyond XFD.
parse_a1_prefix
Parses an A1 reference at the start of s: (col, row, col_abs, row_abs, rest).
quote_sheet
A sheet name as it is written in a reference: quoted, with ' doubled, when Excel quotes it.
sheet_needs_quotes
Whether Excel quotes a sheet name in a reference ('My Sheet'!A1): it starts with a digit or ., holds anything but letters (any script), digits, _ and ., reads as an A1 cell within the sheet or as an R1C1 reference, or is a boolean.
split_areas
The areas of a reference list, split at the commas between them. A comma inside a quoted sheet name ('Sales, West'!A1) is part of the name, and a doubled quote inside the quotes ('O''Brien, Jr'!A1) is an escaped quote, not the end of the name: a quote toggles the quoted state, so a doubled one toggles it twice.
split_sheet
'My Sheet'!A1 → (Some("My Sheet"), A1). Splits at the last !, so a quoted name may hold one ('a!b'!A1).
unquote_sheet
The inverse of quote_sheet: takes the quotes off a sheet name and reads '' as '. Text that isn’t quoted is returned as it is.