# JS简单实现读取Excel文件并转换为JSON **Repository Path**: markchen7788/xlsxToJson ## Basic Information - **Project Name**: JS简单实现读取Excel文件并转换为JSON - **Description**: JS简单实现读取Excel文件并转换为JSON,用到了sheetJs库 - **Primary Language**: JavaScript - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 5 - **Forks**: 1 - **Created**: 2021-04-27 - **Last Updated**: 2024-03-29 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # JS简单实现读取Excel文件并转换为JSON #### 介绍 1. 简单的使用了一下sheetJs,更多详情请看[官方仓库](https://github.com/SheetJS/sheetjs) 2. 可以实现简单的excel文件转Json; 3. 可以将相同格式的Json数组用 [Layui](https://www.layui.com) 数据表格显示。 #### 示例 * 实例一 * 简单转换([点击查看示例一](https://markchen7788.github.io/-JS-Excel-JSON/example/test1.html))
![Image text](./res/test1.gif) * 实例二 * 表格显示([点击查看示例二](https://markchen7788.github.io/-JS-Excel-JSON/example/test2.html))
![Image text](./res/test2.gif) #### 使用说明 1. 在线调用: * 引入js ```html ``` * 在onchange()中指定上传的响应函数 ```html ``` * 给响应函数写回掉函数,以便获取json格式的结果 ```js function getXlsxJson(json) { layui.use('form', function () { var form = layui.form; form.val("formTest", { "text": JSON.stringify(json) }); }); } ``` 2. 下载调用: * 下载仓库中js目录文件,修改一下引入js时的路径,并按照1中方式引入js即可使用;