npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@moluoxixi/excel

v0.0.1

Published

无 UI 依赖的 Excel/CSV 导入导出工具包。它只处理数据、列契约和工作簿生成,不内置按钮、文件选择器、下载器、弹窗或 Vue/Element Plus 依赖。

Downloads

77

Readme

@moluoxixi/excel

无 UI 依赖的 Excel/CSV 导入导出工具包。它只处理数据、列契约和工作簿生成,不内置按钮、文件选择器、下载器、弹窗或 Vue/Element Plus 依赖。

导入 Excel

import { parseExcelBlob } from '@moluoxixi/excel'

const rows = await parseExcelBlob(file, {
  columns: [
    { label: '姓名', prop: 'name' },
    { label: '年龄', prop: 'profile.age' },
  ],
})

columns 默认兼容原组件的 title/labelfield/prop 约定。导入时会按表头匹配字段,只返回已配置列。

导出 Excel

import { createExcelBlob } from '@moluoxixi/excel'

const blob = createExcelBlob({
  columns: [
    { label: '姓名', prop: 'name' },
    { label: '年龄', prop: 'profile.age' },
    {
      label: '序号',
      prop: 'index',
      formatter: (_row, _column, rowIndex) => rowIndex + 1,
    },
  ],
  tableData: [
    { name: '张三', profile: { age: 18 } },
  ],
})

调用方负责下载或上传:

const url = URL.createObjectURL(blob)
const link = document.createElement('a')
link.href = url
link.download = '用户数据.xlsx'
link.click()
URL.revokeObjectURL(url)

API 边界

  • parseExcelRows():从 ArrayBuffer 解析对象数组。
  • parseExcelBlob():从 Blob/File 解析对象数组。
  • mapExcelMatrixToRows<Row>():把二维数组按表头映射为对象数组;Row 泛型只表达调用方已知的静态返回形状,不会校验必填字段是否真实存在。
  • createExcelWorkbook():生成 xlsx 工作簿和工作表,适合二次加工。
  • createExcelWorksheet():生成单个工作表。
  • writeExcelBuffer():输出 xlsx/csv 二进制内容。
  • createExcelBlob():输出浏览器可下载的 Blob

迁移说明

ImportExcel / ExportExcel 组件中的 Vue、Element Plus、按钮状态、事件提示和文件下载逻辑不在本包内。UI 组件可以只负责采集 File、调用本包、再把结果交给业务层。