Interface Summary接口摘要
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).是库的版本(由生成脚本添加)。
XLSX.SSF is an embedded version of the format library.是格式库的嵌入式版本。
XLSX.CFB is an embedded version of the container library.是容器库的嵌入式版本。
Parsing functions解析函数
XLSX.read(data, read_opts) attempts to parse 尝试解析data.data。
XLSX.readFile(filename, read_opts) attempts to read 尝试读取filename and parse.filename并进行解析。
Parse options are described in the Parsing Options section.解析选项在解析选项部分中进行了描述。
Writing functions写入函数
XLSX.write(wb, write_opts) attempts to write the workbook 尝试编写工作簿wb.wb。
XLSX.writeXLSX(wb, write_opts) attempts to write the workbook in XLSX format.尝试以XLSX格式编写工作簿。
XLSX.writeFile(wb, filename, write_opts) attempts to write 尝试将wb to filename. wb写入filename。In browser-based environments, it will attempt to force a client-side download.在基于浏览器的环境中,它将尝试强制客户端下载。
XLSX.writeFileXLSX(wb, filename, write_opts) attempts to write an XLSX file.尝试写入XLSX文件。
XLSX.writeFileAsync(filename, wb, o, cb) attempts to write 尝试将wb to filename. wb写入filename。If 如果省略了o is omitted, the writer will use the third argument as the callback.o,编写器将使用第三个参数作为回调。
Write options are described in the Writing Options section.写入选项在写入选项部分进行了描述。
Utilities实用程序
Utilities are available in the XLSX.utils object.XLSX.utils对象中提供了实用程序。
The following are described in A1 UtilitiesA1实用程序中描述了以下内容
Cell and cell address manipulation:单元格和单元格地址操作:
encode_row / decode_rowconverts between 0-indexed rows and 1-indexed rows.在0索引行和1索引行之间转换。encode_col / decode_colconverts between 0-indexed columns and column names.在0索引列和列名之间转换。encode_cell / decode_cellconverts cell addresses.转换单元格地址。encode_range / decode_rangeconverts cell ranges.转换单元格范围。
The following are described in the Utility Functions:实用程序函数中描述了以下内容:
Constructing:构造:
book_newcreates an empty workbook创建空工作簿book_append_sheetadds a worksheet to a workbook将工作表添加到工作簿
Importing:导入:
aoa_to_sheetconverts an array of arrays of JS data to a worksheet.将JS数据数组转换为工作表。json_to_sheetconverts an array of JS objects to a worksheet.将JS对象数组转换为工作表。table_to_sheetconverts a DOM TABLE element to a worksheet.将DOM表元素转换为工作表。sheet_add_aoaadds an array of arrays of JS data to an existing worksheet.将JS数据数组添加到现有工作表中。sheet_add_jsonadds an array of JS objects to an existing worksheet.将JS对象数组添加到现有工作表中。sheet_add_domadds data from a DOM TABLE element to an existing worksheet.将DOM表元素中的数据添加到现有工作表中。
Exporting:导出:
sheet_to_jsonconverts a worksheet object to an array of JSON objects.将工作表对象转换为JSON对象数组。sheet_to_csvgenerates delimiter-separated-values output.生成分隔符分隔的值输出。sheet_to_txtgenerates UTF16 formatted text.生成UTF16格式的文本。sheet_to_htmlgenerates HTML output.生成HTML输出。sheet_to_formulaegenerates a list of the formulae (with value fallbacks).生成公式列表(具有值回退)。
Miscellaneous杂项
format_cellgenerates the text value for a cell (using number formats).生成单元格的文本值(使用数字格式)。sheet_set_array_formulaadds an array formula to a worksheet将数组公式添加到工作表中
Platform-Specific Functions平台特定功能
NodeJS Streaming Write functionsNode.js流写函数
XLSX.stream contains a set of streaming write functions for NodeJS streams:包含一组用于Node.js流的流写入函数:
to_csv(sheet, opts)streams CSV rows流CSV行to_html(sheet, opts)streams an HTML table incrementally增量流式处理HTML表to_json(sheet, opts)streams JS objects (object-mode stream)streams JS对象(对象模式流)
ESM HelpersESM助手
Due to broad inconsistencies in ESM implementations, the 由于ESM实现中存在广泛的不一致性,mjs build does not import any dependencies. mjs构建没有导入任何依赖项。Instead, they must be manually passed to the library:相反,它们必须手动传递到库:
XLSX.set_cptable sets the internal 设置内部codepage instance. codepage实例。This provides support for different language encodings.这为不同的语言编码提供了支持。
XLSX.set_fs set 设置fs instance (using readFileSync and writeFileSync). fs实例(使用readFileSync和writeFileSync)。This provides NodeJS ESM support for 这为Node.js ESM提供了对XLSX.readFile and XLSX.writeFile.XLSX.readFile和XLSX.writeFile的支持。
XLSX.utils.set_readable supplies a NodeJS 提供Node.js stream.Readable constructor. stream.Readable构造函数。This provides NodeJS ESM support for the streaming operations.