1.0.7 • Published 4 years ago

parseexcel v1.0.7

Weekly downloads
3
License
ISC
Repository
github
Last release
4 years ago

Usage

animalweightcolor
dog20 kgblack
cat5 kgwhite
mouse0.15 kggray

1. Parse excel file by path to array of javaScript objects

const { parseObj } = require('parseexcel')

const resArr = parseObj(filePath)

Result:

resArr = [
           { animal: 'dog', weight: '20 kg', color: 'black' },
           { animal: 'cat', weight: '5 kg', color: 'white' },
           { animal: 'mouse', weight: '0.15 kg', color: 'gray' }
         ]

2. Parse excel file by path to array of JSON

const { parseJson } = require('parseexcel')

const resArr = parseJson(filePath) 

Result:

resArr = [
           '{"animal":"dog","weight":"20 kg","color":"black"}',
           '{"animal":"cat","weight":"5 kg","color":"white"}',
           '{"animal":"mouse","weight":"0.15 kg","color":"gray"}'
         ]

3. Parse excel files (1 or more) from directory to array of javaScript objects

Table 1

phonepricecolor
Xiaomi100 $blue
Samsung150 $white
Nokia50 $black

Table 2

TVpricesizeweight
LG150 $15010
Horizont50 $7012
Panasonic250 $1208

Usage:

const { parseAllObj } = require('parseexcel')

const resArr = parseAllObj(directoryPath) 

Result:

resArr = [
           [
             { phone: 'Xiaomi', price: '100 $', color: 'blue' },
             { phone: 'Samsung', price: '150 $', color: 'white' },
             { phone: 'Nokia', price: '50 $', color: 'black' }
           ],
           [
             { TV: 'LG', price: '150 $', size: 150, weight: 10 },
             { TV: 'Horizont', price: '50 $', size: 70, weight: 12 },
             { TV: 'Panasonic', price: '250$', size: 120, weight: 8 }
           ]
         ]

4. Parse excel files (1 or more) from directory to array of JSON

const { parseAllJson } = require('parseexcel')

const resArr = parseAllJson(directoryPath) 

5. Parse Async excel files (1 or more) from directory to array of javaScript objects

const { parseAllObjAsync } = require('parseexcel')

const resArr = await parseAllObjAsync(directoryPath) 

6. Parse Async excel files (1 or more) from directory to array of JSON

const { parseAllJsonAsync } = require('parseexcel')

const resArr = await parseAllJsonAsync(directoryPath) 
1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.3

4 years ago

1.0.0

4 years ago