sheetjs_sheetjs/docbits/50_csf.md

26 lines
887 B
Markdown
Raw Normal View History

## Common Spreadsheet Format
2021-08-11 02:53:38 +00:00
SheetJS conforms to the Common Spreadsheet Format (CSF):
### General Structures
Cell address objects are stored as `{c:C, r:R}` where `C` and `R` are 0-indexed
column and row numbers, respectively. For example, the cell address `B5` is
represented by the object `{c:1, r:4}`.
Cell range objects are stored as `{s:S, e:E}` where `S` is the first cell and
`E` is the last cell in the range. The ranges are inclusive. For example, the
2017-09-24 23:40:09 +00:00
range `A3:B7` is represented by the object `{s:{c:0, r:2}, e:{c:1, r:6}}`.
Utility functions perform a row-major order walk traversal of a sheet range:
```js
for(var R = range.s.r; R <= range.e.r; ++R) {
for(var C = range.s.c; C <= range.e.c; ++C) {
var cell_address = {c:C, r:R};
2017-09-24 23:40:09 +00:00
/* if an A1-style address is needed, encode the address */
var cell_ref = XLSX.utils.encode_cell(cell_address);
}
}
```