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 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-excel-spliter

v1.0.2

Published

根据自定义条件查询、拆解Excel表格,并生成新Excel的NodeJS工具

Downloads

5

Readme

node-excel-spliter

Split Excel Files by custom search conditions running in NodeJS environment

根据自定义条件,批量拆解 Excel 表格的 NodeJS 小工具

Install 安装

$ npm install node-excel-spliter

Usage 使用方法

const spliter = require("node-excel-spliter");
spliter.run({
  input: { path: "/Users/xxx/Desktop/测试.xlsx" },
  output: {
    path: "/Users/xxx/Desktop/output",
    outputType: "sheets",
    actions: {
      子表1: {
        search: [
          {
            col: "类型",
            value: "器件类",
          },
          {
            col: "名称",
            value: "器件类AAA",
          },
        ],
        count: {
          col: "合计",
        },
        sum: [
          {
            col: "1轮",
          },
          {
            col: "2轮",
          },
          {
            col: "3轮",
          },
          {
            col: "4轮",
          },
        ],
      },
      子表2: {
        search: [
          {
            col: "类型",
            value: "产成品",
          },
          {
            col: "名称",
            value: "产成品AAA",
          },
        ],
        count: {
          col: "合计",
        },
        sum: [
          {
            col: "1轮",
          },
          {
            col: "2轮",
          },
          {
            col: "3轮",
          },
          {
            col: "4轮",
          },
        ],
      },
    },
  },
});

Demo 效果演示

image 原始 Excel 数据

image 脚本执行的过程

image 按条件查询并分割后的 Excel

Configs Detail 配置参数说明

input

Type: object

原始 Excel 文件相关的配置

input.path

Type: string

原始 Excel 文件在磁盘中的绝对路径

output

Type: object

输出的 Excel 文件相关的配置

output.path

Type: string

输出的 Excel 目标文件夹在磁盘中的绝对路径

output.path.outputType?

Type:sheets|files
Default: sheets

值为 sheets 则在一个 Excel 文件中生成多个 sheet;值为 files 生成多个 Excel 文件

output.path.actions

Type: object

对原始 Excel 的拆解规则

output.path.actions.[sheet]

Type: object

在需要拆解生成的 sheets 下定义拆解规则

output.path.actions.[sheet].[action]

Type: search|count|sum

1.例如配置search.col=="类型",search.value=="器件类",则会根据“找到原始Excel中所有【类型】列的值为【器件类】的数据”,可配置多个搜索条件的并集

2.例如配置sum.col=="1轮",则在完成表格拆解后,会自动计算所有数据【1轮】列的值的和,可配置多个列自动求和

3.例如配置count.col=="合计",则在完成表格拆解后,会自动统计所有数据的条数,并写入在最后一条数据的【合计】列的下面