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

gulp_xlsx2sql

v1.0.0

Published

``` js const gulp = require('gulp'); const xlsx2sql = require('gulp_xlsx2sql'); const concat = require('gulp-concat'); const fields = new Map(); // 自定义字段映射 fields.set('性别', 'sex');

Downloads

2

Readme

gulp_xlsx2sql

字段映射设置及配置参考 gulpfile.js

const gulp = require('gulp');
const xlsx2sql = require('gulp_xlsx2sql');
const concat = require('gulp-concat');
const fields = new Map();
// 自定义字段映射
fields.set('性别', 'sex');

gulp.task('default', function (call) {
    gulp.src('xlsx/**/*.xlsx')
        //表格转json
        .pipe(xlsx2sql({
            fieldRow: 1,                    // 数据表字段对应行
            dataRow: 2,                     // 数据表数据开始行
            mainTableName: 'mainweixin',    // 选择目录下(不包含子目录)xlsx文件对应数据表名
            dirToTableName: true,           // 按选择目录的子目录生成表名 
            xlsx_file: true,                // 是否创建数据来源文件名字段
            xlsx_file_as: 'aaaaa',          // 文件名字段设置别名
            trace: true,
        }, fields))
        .pipe(concat('all.sql'))
        .pipe(gulp.dest('msql'));
    call();
});
  • 同级目录下多个xlsx文件的数据会写入到同一个数据表中,主目录以mainTableName指定表名,子目录按目录名生成表名。数据表字段不存在按fieldRow指定行自动创建,中文字段名将自动转为拼音。

环境配置

下载安装Pythonhttps://www.python.org/downloads/

下载安装C++桌面运行环境 参考https://blog.csdn.net/weixin_42066950/article/details/116095391

下载安装Nodehttps://nodejs.org/en/download/

修改npm源地址

npm config set registry https://registry.npm.taobao.org

安装node-gyp

npm install -g node-gyp

安装yarn

npm install -g yarn

设置国内源地址

yarn config set registry https://registry.npm.taobao.org -g 
yarn config set sass_binary_site http://cdn.npm.taobao.org/dist/node-sass -g

下载项目

 git clone https://gitee.com/i-o-i/gulp_xlsx2sql.git

项目目录打开命令行执行项目初始化命令

yarn

项目目录打开命令行执行 xlsx 转 sql 命令

yarn run dev