(s)
| 99 | // Returns the zero-based indexes from a cell reference. |
| 100 | // For example: "A1" -> [0, 0], "B2" -> [1, 1], "AA10" -> [26, 9]. |
| 101 | function fromCellReference(s) { |
| 102 | const [, sc, sr] = s.match(/^([A-Z]*)(\d*)$/); |
| 103 | let c = 0; |
| 104 | if (sc) for (let i = 0; i < sc.length; i++) c += Math.pow(26, sc.length - i - 1) * (sc.charCodeAt(i) - 64); |
| 105 | return [c ? c - 1 : undefined, sr ? +sr - 1 : undefined]; |
| 106 | } |