1.0.2 • Published 3 years ago

node-excel-format v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

Summary

node-excel-format is a node library for format excel data.

Install

npm install node-excel-format --save

Use

  const nef = require('node-excel-format')

  async function main() {
    const config = nef.args.get()
    if (!config) {
      console.error(">>>Please input input file's path")
      return 
    }

    const data = await nef.nio.readXlsx(config.filepath)
    new nef.Parser(data).group(i=>{
      return {
        key: i[1],
        value: i[2],
        options: { 
          code: i[0] 
        }
      }
    }).flatMap((parent, value)=>{
      return createTemplate(parent, value)
    }).writeToFile(config.filepath).printCount()
  }

  function createTemplate(parent, value) {
    return {
      url: '/add',
      body: {
        name: parent.key,
        code: parent.code,
        community: value
      }
    }
  }
  
  main()
1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago