JavaScript – Reading Excel file using node.js! Solved!

This post will show you how can you access the data in your excel sheet(.xlsx) file from your node.js code.

Suppose this is our excel sheet:

excel
excel sheet

Here we are using an existing npm package known as xlsx.

xlsx is a parser and writer for various spreadsheet formats.

Installation:

With npm:

$ npm install xlsx
Usage in node.js
excel2
excel.js
The above code will fetch you the first column values as JavaScript object in an array as shown below:
excel3
output: excel data as JavaScript object

Same code if you have multiple columns:

excel4
Multiple Columns

 

excel5
Output

Hope it helps!

Subscribe for more!

 

Advertisements

One thought on “JavaScript – Reading Excel file using node.js! Solved!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s