Frameworks and Bundlers框架和捆绑包
Each standalone release package is available at https://cdn.sheetjs.com/. 每个独立发布包可在https://cdn.sheetjs.com/上获得。The NodeJS package is designed to be used with frameworks and bundlers. Node.js包设计用于框架和绑定器。It is a proper ECMAScript Module release which can be optimized with developer tools.这是一个合适的ECMAScript模块版本,可以使用开发人员工具进行优化。
- npm
- pnpm
- Yarn
$ npm install --save https://cdn.sheetjs.com/xlsx-0.18.9/xlsx-0.18.9.tgz
$ pnpm install --save https://cdn.sheetjs.com/xlsx-0.18.9/xlsx-0.18.9.tgz
$ yarn add --save https://cdn.sheetjs.com/xlsx-0.18.9/xlsx-0.18.9.tgz
Once installed, the library can be imported under the name 安装后,可以使用xlsx
:xlsx
名称导入库:
import { read, writeFileXLSX } from "xlsx";
XLS SupportXLS支持
If XLS support is required, 如果需要XLS支持,则必须手动导入cpexcel.full.mjs
must be manually imported:cpexcel.full.mjs
:
/* load the codepage support library for extended support with older formats */
import { set_cptable } from "xlsx";
import * as cptable from 'xlsx/dist/cpexcel.full.mjs';
set_cptable(cptable);