AI写作智能体 自主规划任务,支持联网查询和网页读取,多模态高效创作各类分析报告、商业计划、营销方案、教学内容等。 广告
### 解析excel表格 ***** * 安装依赖:`npm install -save vue-xlsx ` * 引入依赖:`import xlsx from 'xlsx'` * 基本使用 * 视图: ``` <el-upload action="" :auto-upload="false" :on-change="onChange" :limit="1" > <el-button type="primary">选择文件</el-button> </el-upload> ``` ``` /* 读取文件 */ readFile(file) { return new Promise((resolve) => { const reader = new FileReader() reader.readAsBinaryString(file) reader.onload = (ev) => { resolve(ev.target.result) } }) }, async onChange(file) { this.$set(this.ruleForm, 'file', file.name) const dataBinary = await this.readFile(file.raw) const workBook = xlsx.read(dataBinary, { type: 'binary', cellDates: true }) const workSheet = workBook.Sheets[workBook.SheetNames[0]] const data = xlsx.utils.sheet_to_json(workSheet) console.log(data) }, ```