# ExcelToJson **Repository Path**: null_235_4994/ExcelToJson ## Basic Information - **Project Name**: ExcelToJson - **Description**: 将excel导出json的工具。支持复杂点的结构。 - **Primary Language**: C# - **License**: MulanPSL-1.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 3 - **Forks**: 1 - **Created**: 2020-05-20 - **Last Updated**: 2024-09-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: Excel, JSON ## README # ExcelToJson #### 介绍 从Excel中导出Json文件 #### Excel书写格式 ![示例](info.png) 导出内容 ``` [ { "height": 189.6, "age": 18, "tags": [ "son" ], "name": "Aaron", "sex": 0 }, { "height": 172.6, "age": 35, "tags": [ "dad", "husband" ], "name": "Denny", "sex": 0 }, { "height": 169.5, "age": 32, "tags": [ "mom", "wife" ], "name": "Oliver", "sex": 1 } ] ``` 1. Excel每张表导出一个同名的Json文件,如果想要忽略表,需要表明以"."开头。 2. Excel内容第一列是标志列,标志列为空的不导出该行。以i开头的第一行为Json属性名称,以i开头的第二行为属性类型。 3. 基本类型说明,数组内容以","间隔。 - s:字符串 - i:整数 - f:浮点数 - sa:字符串数组 - ia:整数数组 - fa:浮点数数组 4. object类型,以o开头的类型则嵌套一个object,要求属性名称也以"."分割object自身和object字段的名称。 - o.s:object字符串 - o.i:object整数 - o.f:object浮点数 - o.sa:object字符串数组 - o.ia:object整数数组 - o.fa:object浮点数数组 5. object数组类型,以oa开头表示object的数组,object数据以";"间隔。也可以根据第一列用"a"表示该行是前面"y"标记行的扩展行。会将该行的数据合并入前面的y行object数组。 - oa.s:object数组字符串 - oa.i:object数组整数 - oa.f:object数组浮点数 - oa.sa:object数组字符串数组 - oa.ia:object数组整数数组 - oa.fa:object数组浮点数数组 ![示例](info2.png) ``` [ { "person": [ { "height": 189.6, "age": 18, "tags": [ "son" ], "name": "Aaron", "sex": 1 }, { "height": 172.6, "age": 35, "tags": [ "dad", "husband" ], "name": "Denny", "sex": 1 }, { "height": 169.5, "age": 32, "tags": [ "mom", "wife" ], "name": "Oliver", "sex": 0 } ], "house": [], "id": "family1" }, { "person": [ { "height": 168.9, "age": 16, "tags": [ "son" ], "name": "Kevin", "sex": 1 }, { "height": 172.3, "age": 28, "tags": [ "dad", "husband" ], "name": "Kyle", "sex": 1 }, { "height": 170.2, "age": 29, "tags": [ "mom", "wife" ], "name": "Jesse", "sex": 0 } ], "house": [ { "address": "somewhere", "area": 256.0 } ], "id": "family2" } ] ``` #### 使用 cmd命令 ``` excelToData 【excel文件地址】 【导出地址】 ```