@borgar/xlsx-convert

中文文档
5.11.2发布于 2026/11/05MITTypeScriptESM + CJS构建来源已验证近 30 天下载 7.2万

Utility to convert Excel XLSX files to JSON

原始使用文档
文档目录4 节
  1. Installing
  2. Usage
  3. # Output:
  4. Documentation

XLSX-convert

This is a utility to convert Excel XLSX files to JSON format. It supports only XLSX files and outputs JSF, JSON spreadsheet format (see below).

The library will run in a browser as well as in server environments (Node, Deno, Bun, etc.).

Installing

The library is also provided as an NPM package:

$ npm install @borgar/xlsx-convert

Usage

// import the converter
import xlsxConvert from '@borgar/xlsx-convert';

// read the file
const jsf = await xlsxConvert('path/to/workbook.xlsx', options);

// emit results
console.log(jsf);

This will emit a structure like this:

{
  "filename": "workbook.xlsx",
  "sheets": [
    {
      "cells": {
        "A1": { "v": 12 },
        "B1": { "v": 123.1 },
        "A2": { "v": "Total" },
        "B2": { "v": 135.1, "f": "SUM(A1:B1)", },
      },
      "merges": [],
      "colWidths": [],
      "rowHeights": [],
      "hidden": 0,
      "name": "Sheet1"
    }
  ],
  "names": [],
  "styles": [
    { "font-size": 12 }
  ]
}

# Output:

The JSON spreadsheet format is similar to, but not compatible with the CSF structure used by the xlsx package.

Supported cell properties are:

Cell.Note
vValue of the cell in its correct type.
fAn integer index into a list of formula expressions in R1C1-syntax, or an expression string in A1-syntax.
FThe A1-style range of enclosing array if the formula is an array formula.
cA list of comments attached to the cell.
s (optional)Index of style information associated with the cell.
t (optional)A type for the value in the cell (this library only emits an "e" when the value is an error).
l (optional)A URL attached to the cell.

Only cells that have "relevant data" are emitted, which in praxis means cells that have such things as values, formula, and visible styles attached to them.

Documentation

Documentation can be found under docs/:


Development of @borgar/xlsx-convert is sponsored by GRID, the spreadsheet engine for AI agents.

版本与发布记录

@borgar/xlsx-convert 共发布 53 个版本,首次发布于 2021/06/30;过去 12 个月发布了 30 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
5.11.2latest2026/11/052 天前
5.11.12026/11/026 天前
5.11.02026/10/2810 天前
5.10.02026/10/2118 天前
5.9.02026/10/2019 天前
5.8.12026/10/011 个月前

关于 @borgar/xlsx-convert 的常见问题

@borgar/xlsx-convert 是什么?

Utility to convert Excel XLSX files to JSON

如何安装 @borgar/xlsx-convert?

在项目目录运行 npm install @borgar/xlsx-convert,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 xlsx-convert,可以用 npx xlsx-convert 直接运行。

@borgar/xlsx-convert 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@borgar/xlsx-convert 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@borgar/xlsx-convert 可以商用吗?

@borgar/xlsx-convert 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@borgar/xlsx-convert 的下载量有多少?

根据 npm 官方下载统计,@borgar/xlsx-convert 在 2026/10/09 – 2026/11/07 这 30 天内被下载 71,579 次,日均约 2,386 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@borgar/xlsx-convert 还在维护吗?

最新版本 5.11.2 发布于 2026/11/05(2 天前);至今共发布 53 个版本,其中过去 12 个月发布了 30 个;首次发布于 2021/06/30。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。