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:

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

The above code will fetch you the first column values as JavaScript object in an array as shown below:

Same code if you have multiple columns:


Hope it helps!
Subscribe for more!
worked great. Thanks!
LikeLike
how to open create excel file in node js
LikeLike
Great – until you have a complicated excel with forumulae.
LikeLike
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.
LikeLike
Supppose in my excel headers
Name Age
Above is name Enter digit
Rakesh 30
I want to generate
Same array of object but it’s not working due to extra note contains in header
LikeLike
Excel with headers having more details example – fname with enter character only.. How you will parse
LikeLike