Work with A1 notation like "A1" or "A1:B2"
npm install @segment/a1-notation
npm i @segment/a1-notation -d
`
Or
`
yarn add @segment/a1-notation
`$3
[4]: dist/index.next.min.js
[5]: dist/index.umd.js[ESNext.min(5 KB)][4], [UMD(22 KB)][5]
$3
[11]: https://www.google.com/search?q=js+umd+is
[12]: src/converters.ts#L13
[13]: src/converters.ts#L30
* converter 1 or converter 2? The difference is in the algorithm of convertation. You can compare [the first method][12] with [the second method][13].
* "ES5" or "ESNext"? ES5 has already converted to ES5 standard with all needed polyfills. ESNext uses the original syntax of the code.
* "UMD"? UMD - Unified Module Definition, more in [Google][11].
* ".min"? Minified version.
* Default version in npm is UMD ESNext. This version is not transpiled and minified, so you need to transpile and minify it.
Initialization
`js
import A1 from '@segment/a1-notation';
// or
const A1 = require('@segment/a1-notation');
`API
Note: A1 string could be represented in any register.
A1 === a1, A1:B2 === a1:b2 === A1:b2 === a1:B2`- static isValid(a1: string): boolean
- static getCol(a1: string, converter: 1 | 2 = 1): number
- static getLastCol(a1: string, converter: 1 | 2 = 1): number
- static getRow(a1: string): number
- static getLastRow(a1: string): number
- static getWidth(a1: string, converter: 1 | 2 = 1): number
- static getHeight(a1: string): number
- static toCol(col: number): string
- static toRow(row: number): string
- constructor
- get(): string
- toString(): string
- toJSON(): result
- getCol(): number
- getLastCol(): number
- getRow(): number
- getLastRow(): number
- getWidth(): number
- getHeight(): number
- setCol(val: string | number): this
- setLastCol(val: string | number): this
- setRow(val: string | number): this
- setLastRow(val: string | number): this
- copy(): A1
- addX(count: number): this
- addY(count: number): this
- add(countX: number, countY: number): this
- removeX(count: number): this
- removeY(count: number): this
- remove(countX: number, countY: number): this
- shiftX(offset: number): this
- shiftY(offset: number): this
- shift(offsetX: number, offsetY: number): this