在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:koalaylj/xlsx2json开源软件地址:https://github.com/koalaylj/xlsx2json开源编程语言:JavaScript 98.6%开源软件介绍:English Document)xlsx2json (
使用说明
# Clone this repository
git clone https://github.com/koalaylj/xlsx2json.git
# Go into the repository
cd xlsx2json
# Install dependencies
npm install
{
"xlsx": {
/**
* 表头所在的行,第一行可以是注释,第二行是表头
*/
"head": 2,
/**
* xlsx文件所在的目录
* glob配置风格
*/
"src": "./excel/**/[^~$]*.xlsx",
/**
* 导出的json存放的位置
*/
"dest": "./json"
},
/**
* 是否导出d.ts(for typescript)
* 一张表格只导出一个d.ts文件
* true:生成d.ts,false:不生成
*/
"ts":false,
"json": {
/**
* 导出的json是否需要压缩
* true:压缩,false:不压缩(便于阅读的格式)
*/
"uglify": false
}
}
示例1 基本功能(参考./excel/basic.xlsx)输出如下(因为设置了 {
"1111": {
"id": 1111,
"name": "风暴之灵",
"slogen": ["风暴之灵已走远","在这场风暴里没有安全的港湾啊,昆卡!"],
"skill": {
"R": {
"name": "残影",
"冷却时间": [3.5,3.5,3.5,3.5],
"作用范围": 260,
"主动技能": true,
"levels": [
{"level": 1,"damage": 140,"mana": 70},
{"level": 2,"damage": 180,"mana": 80}
]
},
"E": {
"name": "电子漩涡",
"冷却时间": [21,20,19,18],
"主动技能": true,
"levels": [
{"level": 1,"time": 1,"cost": 100,"distance": 100},
{"level": 2,"time": 1.5,"cost": 110,"distance": 150}
]
}
}
},
"1112": {
"id": 1112,
"name": "幽鬼",
"slogen": null,
"skill": null
}
} 如果将第一列的 [
{
"id": "1111",
"name": "风暴之灵",
"slogen": ["风暴之灵已走远","在这场风暴里没有安全的港湾啊,昆卡!"],
"skill": {
"R": {
"name": "残影",
"冷却时间": [3.5,3.5,3.5,3.5],
"作用范围": 260,
"主动技能": true,
"levels": [
{"level": 1,"damage": 140,"mana": 70},
{"level": 2,"damage": 180,"mana": 80}
]
},
"E": {
"name": "电子漩涡",
"冷却时间": [21,20,19,18],
"主动技能": true,
"levels": [
{"level": 1,"time": 1,"cost": 100,"distance": 100},
{"level": 2,"time": 1.5,"cost": 110,"distance": 150}
]
}
}
},
{
"id": "1112",
"name": "幽鬼",
"slogen": null,
"skill": null
}
] 示例2 复杂表格拆分(参考./excel/master-slave.xlsx)如果一个表格某一列是 比如上图中的 支持以下数据类型
表头规则
sheet规则
主从表相关规则(master/slave)
注意事项
TODO
分支
补充
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论