Created
September 21, 2015 12:53
-
-
Save Praseetha-KR/eb81f2b28b5b55699596 to your computer and use it in GitHub Desktop.
Excel to JSON, dependency https://github.com/SheetJS/js-xlsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
let XLSX = require('xlsx'); | |
let workbook = XLSX.readFile(process.argv[3]); | |
let sheets = workbook.Workbook.Sheets.map(obj => obj.name); | |
let mails = sheets.reduce((acc, elem) => { | |
let sheet = workbook.Sheets[elem]; | |
let mailArr = Object.keys(sheet).map(cell => sheet[cell].v).filter(val => val).filter((val, index) => index); | |
return acc.concat(mailArr); | |
}, []); | |
console.log(JSON.stringify(mails, null, '\t')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment