通过js读取Excel文件

关于通过JavaScript读取Excel中的数据,可以通过

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<html>
<header>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script src="https://unpkg.com/read-excel-file@4.x/bundle/read-excel-file.min.js"></script>
<script>
$( document ).ready(function() {
var input = document.getElementById('input')
if(input) {
input.addEventListener('change', function() {
readXlsxFile(input.files[0]).then(rows => {
console.log(rows);
})
})
}
});
</script>
</header>

<body>
<input type="file" id="input" />
<div id='result'></div>
</body>
</html>