{"id":28399868,"url":"https://github.com/fish-tennis/excelexporter","last_synced_at":"2025-09-11T02:41:09.293Z","repository":{"id":294629011,"uuid":"983200632","full_name":"fish-tennis/excelexporter","owner":"fish-tennis","description":"excel export tool 适用于游戏项目的Excel配置表导出工具","archived":false,"fork":false,"pushed_at":"2025-08-29T08:25:05.000Z","size":225,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-29T12:20:42.033Z","etag":null,"topics":["excel","exporter","json","proto"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fish-tennis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-14T03:16:37.000Z","updated_at":"2025-08-29T08:25:08.000Z","dependencies_parsed_at":"2025-06-28T02:35:03.079Z","dependency_job_id":"ee09de95-6c18-43f1-b0af-be542c3903a2","html_url":"https://github.com/fish-tennis/excelexporter","commit_stats":null,"previous_names":["fish-tennis/excelexporter"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fish-tennis/excelexporter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fish-tennis%2Fexcelexporter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fish-tennis%2Fexcelexporter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fish-tennis%2Fexcelexporter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fish-tennis%2Fexcelexporter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fish-tennis","download_url":"https://codeload.github.com/fish-tennis/excelexporter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fish-tennis%2Fexcelexporter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274568729,"owners_count":25309283,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-11T02:00:13.660Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["excel","exporter","json","proto"],"created_at":"2025-06-01T08:11:31.038Z","updated_at":"2025-09-11T02:41:09.286Z","avatar_url":"https://github.com/fish-tennis.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# excelexporter\n适用于游戏项目的Excel配置表导出工具\n\n## Excel导出\n- 数据结构定义在proto文件中\n- 解析proto文件,获取proto中的message的结构信息\n- 解析Excel配置表,列名就是proto中定义的message的字段名\n- 导出为proto对应的json格式(也可以扩展为导出proto序列化后的二进制数据,以便于更高效的加载)\n- 支持批量导出,在一个excel里配置所有需要导出的配置表,可以批量导出并生成加载代码,把加载代码放到项目中,\n可以一个接口就完成加载所有数据,并支持并发,热更新,增量加载\n- 支持配置表关联检查\n- 支持不同的配置表合并导出到同一个文件里\n- 测试用例在tool/export_test.go\n\n## 项目导入\n- 加载导出的json数据(或二进制数据),直接反序列化成proto的message对象\n- 测试用例在example/import_test.go\n\n## 命令行\n```shell\nexcelexporter -config=.\\exporter.yaml\n```\nconfig: 配置文件\n```yaml\n#Excel导入目录(excel所在目录)\nDataImportPath: \"./data/excel\"\n\n#数据导出目录\nDataExportPath: \"./data/json\"\n\n#proto所在目录\nProtoPath: \"./proto\"\n\n#需要解析的proto文件\nProtoFiles:\n  - \"export.proto\"\n  - \"cfg.proto\"\n\n#可选项:导出md5文件完整路径\nMd5ExportPath: \"./data/json/md5.json\"\n\n#代码模板目录\nCodeTemplatePath: \"./template/\"\n\n#代码模板\nCodeTemplateFiles:\n  - \"data_mgr.go.template\"\n#代码导出目录 NOTE:和CodeTemplateFiles的数量要一致\nCodeExportFiles:\n  - \"./cfg/data_mgr.go\"\n\n#导出分组标记 c s cs\nExportGroup: \"s\"\n\n#默认的分组标记\nDefaultGroup: \"cs\"\n\n#导出总表的文件名\nExportAllExcelFile: \"all.xlsx\"\n\n#导出总表的sheet名\nExportAllSheet: \"ExportCfg\"\n```\n\n## 简单示例1:\n- 由于proto文件中已经定义了数据结构,所以excel里只需要列名和proto定义的字段名一致,就可以知道字段的类型信息,\n所以excel里不需要再指定字段类型,假设物品的proto定义如下\n```protobuf3\nmessage Item {\n  int32 Id = 1;\n  int32 Type = 2;\n  string Name = 3;\n}\n```\n那么物品配置表的excel格式就可以这样:\n```\n-------------------------\n| Id     | Type  | Name |\n-------------------------\n| 1      | 1     | 物品1 |\n-------------------------\n| 2      | 1     | 物品2 |\n-------------------------\n| 3      | 2     | 物品3 |\n-------------------------\n```\n\n## 示例2:字段也是message结构\n```protobuf3\nmessage Test {\n  int32 Id = 1;\n  Item Item1 = 2;\n  Item Item2 = 3;\n  repeated Item Items = 4;\n}\n```\n配置表的excel格式就可以这样:\n```\n-------------------------------------------------------------\n| Id  | Item1      | Item2                 | Items          |\n|     | #Field=no  | #Field=full           | #Field=Id_Type |\n-------------------------------------------------------------\n| 1   | 1_1_物品1   | Id_1#Type_1#Name_物品1 | 1_1;2_1        |\n-------------------------------------------------------------\n| 2   | 2_1_物品2   | Id_2#Type_1#Name_物品2 | 2_1;3_2        |\n-------------------------------------------------------------\n| 3   | 3_2_物品3   | Id_3#Type_2#Name_物品3 | 3_2;1_1        |\n-------------------------------------------------------------\n```\n一个单元格要配置一个message的数据,就需要在一个单元格里填写多个字段的数据\n- #Field=no   表示Item1不需要填写字段名,以_作为分隔符,按照字段顺序进行赋值,适用于字段少的结构简单的message,\n缺点是兼容性差,当message的字段做了更新,可能导致解析异常\n- #Field=full 表示Item2需要填写字段名,以Field1_v1#Field2_v2的格式,按照字段名进行赋值,填写麻烦但是兼容性强,\n当message增删了字段或者调整了字段的顺序,也不影响字段的解析\n- #Field=Field1_Field2_FieldN 是前2种格式的结合,既简洁又保留了兼容性,解析时会按照表头指定的字段名进行赋值,\n且单元格不需要再每行填写字段名\n\n## 示例3: 单元格使用json格式\n```\n-----------------------------------------------------------------------\n| Id  | Item1      | Item2                           | Items          |\n|     | #Field=no  | #Format=json                    | #Field=Id_Type |\n-----------------------------------------------------------------------\n| 1   | 1_1_物品1   | {\"Id\":1,\"Type\":1,\"Name\":\"物品1\"} | 1_1;2_1        |\n-----------------------------------------------------------------------\n| 2   | 2_1_物品2   | {\"Id\":2,\"Type\":1,\"Name\":\"物品2\"} | 2_1;3_2        |\n-----------------------------------------------------------------------\n| 3   | 3_2_物品3   | {\"Id\":3,\"Type\":2,\"Name\":\"物品3\"} | 3_2;1_1        |\n-----------------------------------------------------------------------\n```\n\n## 示例4: 单元格关联检查\n格式: #Ref=要关联检查的配置表名,假如有一个配置表Item,下面的Item2配置了#Ref=Item,在导表时,将会自动关联检查Item2中配置的Id是否在Item中存在,如果不存在,将会输出错误信息\n```\n-------------------------------------------------------------\n| Id  | Item1      | Item2                 | Items          |\n|     | #Field=no  | #Field=full#Ref=Item  | #Field=Id_Type |\n-------------------------------------------------------------\n| 1   | 1_1_物品1   | Id_1#Type_1#Name_物品1 | 1_1;2_1        |\n-------------------------------------------------------------\n| 2   | 2_1_物品2   | Id_2#Type_1#Name_物品2 | 2_1;3_2        |\n-------------------------------------------------------------\n| 3   | 3_2_物品3   | Id_3#Type_2#Name_物品3 | 3_2;1_1        |\n-------------------------------------------------------------\n```\n\n## TODO:\n- 导出protobuf二进制数据\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffish-tennis%2Fexcelexporter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffish-tennis%2Fexcelexporter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffish-tennis%2Fexcelexporter/lists"}