<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<script src="alasql.js"></script>
<script src="xlsx.core.min.js"></script>
</head>
<body>
<button onclick="aa()">下载Excel</button>
</body>
<script type="text/javascript">
var arr = [{
'姓名': '张三',
'年龄': '23',
'性别': '男'
}, {
'姓名': '李四',
'年龄': '23',
'性别': '男'
}]
function aa() {
alasql('SELECT * INTO XLS("表格.xls",{headers:true}) FROM ?', [arr]);
}
</script>
</html>
alasql.js
下载链接:https://download.csdn.net/download/EstherNi/87701248
xlsx.core.min.js
下载链接:https://download.csdn.net/download/EstherNi/87701240