Skip to content

kukuruznik/excel-data

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Installation

npm install excel-data

Read Data

import {read} from 'excel-data'
//var read = require('excel-data').read;

read(
	[
		'test1.xlsx', 
		'test2.xlsx', 
		...
	],
	{
		skipRows: 0,		// optional: ignore first N rows
		mergeData: true,	// optional: merge same data from all sheets
		acceptsSheet: sheetName => sheetName.startsWith('employee')	// optional: sheetName as already in lowercase
	}
)
.then(result => {
	// code to proceed result
})

Result

with mergeData = false

{
	employee_2015: { //excel sheet name in lowercase & no spaces
		header: {
			originalColumns: ['First Name', 'Last Name', 'Email', 'DOB'],
			columns: ['firstname', 'lastname', 'email', 'dob']			
		},
		data: [
			{firstname: 'Bill', lastname: 'Gates', email: '[email protected]', dob: '4/1/1945'},
			{firstname: 'Barack', lastname: 'Obama', email: '[email protected]', dob: '6/30/1965'},
		]
	},
	employee_2016: {
		header: {
			originalColumns: ...
			columns: ...
		},
		data: [
			...
		]
	}
}

with mergeData = true

{
	all: {	// all: represent for all sheets
		header: {
			originalColumns: ['First Name', 'Last Name', 'Email', 'DOB'],
			columns: ['firstname', 'lastname', 'email', 'dob']			
		},
		data: [
			{firstname: 'Bill', lastname: 'Gates', email: '[email protected]', dob: '4/1/1945'},
			{firstname: 'Barack', lastname: 'Obama', email: '[email protected]', dob: '6/30/1965'},
		]
	}
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published