解析excel的方案

早上的时候想做个东西把产品给的execl 纬度表,转成json。

方案有很多:

1.转成cvs,导入到mysql 数据库里去。
2.nodejs npm包去解析。(有些包其实是机遇python的)
3.gulp作处理。
最终选择了 gulp-excel2html

var gulp = require('gulp');
var excel2html = require('gulp-excel2html');
gulp.task('jshtml', function() {
  gulp.src('weidu.xlsx')
  .pipe(excel2html({
      tmplFile:'foo_template.html',
      resultFile:'result.html',
      dataHandle:function(excel){
          //handle excel data and return something
          var sheet1 = excel.shift(),
                // 读取行数据
                rows = sheet1.data;
            return {
                rows:rows,
                getName:function(){
                    return this;
                }
            };
      }
  }))
  .pipe(gulp.dest('./'));
});
gulp.task('default', ['jshtml']);

你可能感兴趣的:(解析excel的方案)