Sheety::CellRefs
Shared A1-style column letter <-> number conversion.
Excel columns use bijective base-26: A=1, Z=26, AA=27, and so on. This conversion previously existed as seven copy-pasted variants across the TUI, the dependency extractor, the runtime helpers baked into generated binaries, and the Excel exporter; they are all defined here now.
Constants
Highest row/column sheety's fixed 1000x1000 grid addresses. Whole-column ranges (A:B) clamp their rows to this.
Class methods
Convert column letter(s) to a 1-based number ("A" -> 1, "AA" -> 27). Input is upcased, so callers may pass either case.
Convert a 1-based number to column letter(s) (1 -> "A", 27 -> "AA"). Returns "" for 0, matching the behavior of every previous copy.
Parse an A1-style range into normalized bounds, or return nil when the range is unsupported.
Accepted forms (any case, with or without $ anchors):
- "A1:B5" concrete range; reversed bounds (e.g. "B2:A1") are swapped, matching Excel's normalization
- "A:B" whole-column range, clamped to rows 1..GRID_MAX
Whole-row ranges ("1:10") and anything else return nil; callers treat that as a loud per-formula failure rather than silently computing over an empty set of cells.
Parse a single cell reference ("A1", "$B$2") into 1-based column/row, or nil if it doesn't have that shape.