npm i xlsx
import axios from 'axios';
axios //这里用自己封装的http是不行的,踩过坑
.get(url,{ responseType: "arraybuffer" })
.then((re) => {console.log(re)
let res = re.data
var XLSX = require("xlsx");
let wb = XLSX.read(res, {
type: 'arraybuffer'
});
console.log('9999999999999999999999',wb)
let worksheet = XLSX.utils.sheet_to_json(wb.Sheets[wb.SheetNames[0]]); // 将一个 JavaScript 对象或值转换为 JSON 字符串
console.log(worksheet)
})
执行结果: