2017-03-20 09:02:25 +00:00
|
|
|
## Interface
|
|
|
|
|
|
|
|
`XLSX` is the exposed variable in the browser and the exported node variable
|
|
|
|
|
|
|
|
`XLSX.version` is the version of the library (added by the build script).
|
|
|
|
|
2022-04-28 07:59:37 +00:00
|
|
|
`XLSX.SSF` is an embedded version of the [format library](https://github.com/SheetJS/ssf).
|
2017-03-20 09:02:25 +00:00
|
|
|
|
|
|
|
### Parsing functions
|
|
|
|
|
|
|
|
`XLSX.read(data, read_opts)` attempts to parse `data`.
|
|
|
|
|
|
|
|
`XLSX.readFile(filename, read_opts)` attempts to read `filename` and parse.
|
|
|
|
|
|
|
|
Parse options are described in the [Parsing Options](#parsing-options) section.
|
|
|
|
|
|
|
|
### Writing functions
|
|
|
|
|
|
|
|
`XLSX.write(wb, write_opts)` attempts to write the workbook `wb`
|
|
|
|
|
2018-02-03 20:46:32 +00:00
|
|
|
`XLSX.writeFile(wb, filename, write_opts)` attempts to write `wb` to `filename`.
|
|
|
|
In browser-based environments, it will attempt to force a client-side download.
|
2017-03-20 09:02:25 +00:00
|
|
|
|
2022-04-18 03:09:41 +00:00
|
|
|
`XLSX.writeFileAsync(filename, wb, o, cb)` attempts to write `wb` to `filename`.
|
2017-03-25 01:36:40 +00:00
|
|
|
If `o` is omitted, the writer will use the third argument as the callback.
|
|
|
|
|
2017-04-16 07:31:21 +00:00
|
|
|
`XLSX.stream` contains a set of streaming write functions.
|
|
|
|
|
2017-03-20 09:02:25 +00:00
|
|
|
Write options are described in the [Writing Options](#writing-options) section.
|
|
|
|
|
|
|
|
### Utilities
|
|
|
|
|
2017-08-08 20:31:17 +00:00
|
|
|
Utilities are available in the `XLSX.utils` object and are described in the
|
|
|
|
[Utility Functions](#utility-functions) section:
|
2017-03-20 09:02:25 +00:00
|
|
|
|
2022-02-04 05:29:01 +00:00
|
|
|
**Constructing:**
|
|
|
|
|
|
|
|
- `book_new` creates an empty workbook
|
|
|
|
- `book_append_sheet` adds a worksheet to a workbook
|
|
|
|
|
2017-03-25 01:36:40 +00:00
|
|
|
**Importing:**
|
|
|
|
|
|
|
|
- `aoa_to_sheet` converts an array of arrays of JS data to a worksheet.
|
2017-05-11 18:23:21 +00:00
|
|
|
- `json_to_sheet` converts an array of JS objects to a worksheet.
|
2017-05-16 17:45:35 +00:00
|
|
|
- `table_to_sheet` converts a DOM TABLE element to a worksheet.
|
2018-01-09 07:36:02 +00:00
|
|
|
- `sheet_add_aoa` adds an array of arrays of JS data to an existing worksheet.
|
|
|
|
- `sheet_add_json` adds an array of JS objects to an existing worksheet.
|
2017-03-25 01:36:40 +00:00
|
|
|
|
2017-09-24 23:40:09 +00:00
|
|
|
|
2017-03-20 09:02:25 +00:00
|
|
|
**Exporting:**
|
|
|
|
|
|
|
|
- `sheet_to_json` converts a worksheet object to an array of JSON objects.
|
|
|
|
- `sheet_to_csv` generates delimiter-separated-values output.
|
2017-12-01 05:48:10 +00:00
|
|
|
- `sheet_to_txt` generates UTF16 formatted text.
|
2017-05-16 17:45:35 +00:00
|
|
|
- `sheet_to_html` generates HTML output.
|
2017-03-20 09:02:25 +00:00
|
|
|
- `sheet_to_formulae` generates a list of the formulae (with value fallbacks).
|
|
|
|
|
|
|
|
|
|
|
|
**Cell and cell address manipulation:**
|
|
|
|
|
2017-09-24 23:40:09 +00:00
|
|
|
- `format_cell` generates the text value for a cell (using number formats).
|
|
|
|
- `encode_row / decode_row` converts between 0-indexed rows and 1-indexed rows.
|
|
|
|
- `encode_col / decode_col` converts between 0-indexed columns and column names.
|
|
|
|
- `encode_cell / decode_cell` converts cell addresses.
|
|
|
|
- `encode_range / decode_range` converts cell ranges.
|
2017-03-20 09:02:25 +00:00
|
|
|
|