Home > Web Front-end > JS Tutorial > A brief discussion on how nodejs uses the node-xlsx module to read excel data

A brief discussion on how nodejs uses the node-xlsx module to read excel data

青灯夜游
Release: 2021-04-07 10:00:42
forward
4923 people have browsed it

This article will introduce to you nodejsHow to use the node-xlsx module to read excel table data. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.

A brief discussion on how nodejs uses the node-xlsx module to read excel data

Related recommendations: "nodejs Tutorial"

1. Install node-xlsx

node-xlsx module is used to read the content in the xlsx file, which is the content of the excel table

npm install node-xlsx --save
Copy after login

2. Use node-xlsx Reading table data

const nodeXlsx = require('node-xlsx')	//引用node-xlsx模块

//下方ex1是读取出来的数组,数组长度取决于Excel文件的工作表(sheet)
const ex1 = nodeXlsx.parse("./ex1.xls")	//读取excel表格

let excel_content = ex1[0].data	//取出excel文件中的第一个工作表中的全部数据

excel_content .splice(0,1)	//一般来说表中的第一条数据可能是标题没有用,所以删掉

console.log(excel_content)	//查看读取出来的数据
Copy after login

For more programming-related knowledge, please visit: Programming Video! !

The above is the detailed content of A brief discussion on how nodejs uses the node-xlsx module to read excel data. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template