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!

 

Advertisement

7 thoughts on “JavaScript – Reading Excel file using node.js! Solved!

    1. Where can I find a concrete resources for node js? A documentation which states all the attribute, methods used and how xlsx, excel sheet are created, deleted and removed, would be more useful.

      Like

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 )

Facebook photo

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

Connecting to %s