2020-12-24 17:58:07 +08:00
2020-07-24 14:20:34 +08:00
2020-05-17 14:36:52 +08:00
2020-11-12 22:36:04 +08:00
2020-11-12 22:36:04 +08:00
2020-07-24 14:20:34 +08:00
2020-11-12 22:36:04 +08:00
2020-11-12 22:36:04 +08:00
2020-05-17 14:36:52 +08:00
2020-05-17 14:36:52 +08:00
2020-07-24 14:20:34 +08:00
2020-07-24 14:20:34 +08:00

Excel 配置表数据导出工具

将 Excel 配置表中的数据导出为方便程序读取和使用的数据。

支持将Excel配置表导出为:

  • JSON 文件
  • YAML 文件
  • C# 类型声明
  • TypeScript interface类型声明、class类型定义可用 instanceof 进行类型检查)
  • Godot 引擎的 GDScript 脚本文件

表格格式说明

  • 每个 xlsl 文件中可以有多张表Sheet每张表会都导出一份数据文件表名必须符合标识符规范
  • 表名为 @skip 或以 @skip 开头的表会被忽略,不会导出数据文件
  • 第一列值为 @skip 的行会被忽略,视为无效数据行
  • 整行所有列为空的行会被忽略,视为无效数据行
  • 每张表的第一个有效数据行用作字段名,决定了导出数据所拥有的属性,字段名必须符合标识符命名规范
  • 字段名所在的行中不填名称的列视为空字段,该列的数据在导出时会被忽略
  • 相同名称的字段导出时会被合并为数组
  • 导出属性的数据类型由整列所填写的数据类型决定,支持以下数据类型
    • 字符串
    • 数值(优先使用整形)
    • 布尔值
    • 空(null)
  • 该工具设计原则是简单易用,表格字段可由策划自由调整,不支持数据引用,暂不支持结构体

安装

  • 安装 NodeJS 和 NPM, 注意将 Node 和 NPM 添加到环境变量 PATH
  • 执行下面的命令构建项目,将生成的 dist 复制到到您的项目中
npm run build

使用

  • 按照上面介绍的规则填写 Excel 配置表
  • 修改 excel-exporter.yaml 修改工具配置,配置要读取的 Excel 文件列表,配置你需要的导出器
  • Windows 下双击 转表.bat 执行转换工作
  • Linux/macOS 下执行 转表.sh 执行转换工作

配置示例

parser:
  first_row_as_field_comment: true
input:
- file: 配置表.xlsx
  encode: GBK
output:
  json:
    enabled: true
    directory: output/json
    indent: "\t"
  yaml:
    enabled: true
    directory: output/yaml
    indent: 2
  csharp:
    enabled: true
    directory: output/csharp
    namespace: game.data
    base_type: tiny.data.UniqueIDObject
    file_name: data
    ignore_id: true
  typescript:
    enabled: true
    declaration: false
    type: class
    class_name_prefix: ''
    class_name_extension: Data
    directory: output/typescript
    file_name: data
Description
Excel 配置表导出工具
Readme 177 KiB
Languages
TypeScript 95.9%
JavaScript 3.8%
Shell 0.2%
Batchfile 0.1%