# excel_exporter **Repository Path**: lsxh/excel_exporter ## Basic Information - **Project Name**: excel_exporter - **Description**: go语言实现导表工具,将excel导出为json和lua文件 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-11-10 - **Last Updated**: 2026-01-04 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## 导表配置说明 ```json { "exports": [ { "excel_path": "./excel/测试导表.xlsx", "server_output_dir": "./output/server", // 配置输出服务器路径 "client_output_dir": "./output/client", "sheets": [ { "sheet_name": "玩家", // 子表名称 "server_file_name": "player", // 导出文件名称 "client_file_name": "player", "processor": "default", // 导表处理函数 "server_processor": "server_only", // 服务器导表处理函数 "client_processor": "client_only", // 客户端导表处理函数 }, { "sheet_name": "Sheet2", "server_file_name": "sheet2", "client_file_name": "sheet2", "processor": "gender_processor" } ] }, { "excel_path": "./excel/测试导表2.xlsx", // excel文件 "server_output_dir": "./output/server", // 配置输出服务器路径 "client_output_dir": "./output/client", // 配置输出客户端路径 "sheets": [ // 需要导出的子表,数组,每个子表一条 { "sheet_name": "道具", // 子表名称 "server_file_name": "item", // 导出文件名称 "client_file_name": "item", "processor": "default", // 导表处理函数 "key_field": "ItemId", // 主键,默认为Id,这里可以自己定义 }, { "sheet_name": "奖励表", "server_file_name": "reward", "client_file_name": "reward", "processor": "reward_processor", // 关联其他表的逻辑自己加 "key_field": "RewardId" } ] }, // 常量表导出 { "excel_path": "./excel/测试常量表.xlsx", "server_output_dir": "./output/server", "client_output_dir": "./output/client", "sheets": [ { "sheet_name": "常量", "server_file_name": "const", "client_file_name": "const", "processor": "default", // 也可以自己定义 "is_constant_table": true, "constant_key_field": "常量名", // key "constant_value_field": "常量值" // value } ] } ] } ``` ## 自定义导表函数 - 新加的配置表,如果导表数据需要单独处理,新增processor函数(config/processor.go)注册一下函数 - 新增函数,default函数在processor.go里面其他测试函数在config/common_processor.go里面 ## 导表工具编译运行 ```shell # 导出所有Excel文件(默认行为) go run main.go # 导出指定配置文件的所有Excel文件 go run main.go -config config.json # 导出指定的Excel文件(使用完整路径) go run main.go -excel "./excel/测试导表.xlsx" # 导出指定的Excel文件(使用文件名) go run main.go -excel "测试导表.xlsx" # 导出多个指定的Excel文件 go run main.go -excel "测试导表.xlsx,测试导表2.xlsx" # 组合使用配置文件和指定Excel go run main.go -config config.json -excel "测试导表.xlsx" ``` ```shell #编译运行 go build -o excel_exporter main.go ./excel_exporter -xxx "xxx.excel" ```