All Projects → youlanhai → ExcelToCode

youlanhai / ExcelToCode

Licence: MIT license
将Excel表转换成Python, Lua, json数据表,自动生成java类。

Programming Languages

python
139335 projects - #7 most used programming language

Labels

Projects that are alternatives of or similar to ExcelToCode

office-addin-react
To help you learn to use Office.js and React build an Excel add-in
Stars: ✭ 46 (-17.86%)
Mutual labels:  excel
FluentExcel
Use Fluent API to configure POCO excel behaviors, and then provides IEnumerable<T> has save to and load from excel functionalities.
Stars: ✭ 73 (+30.36%)
Mutual labels:  excel
Qxlnt
Use xlnt in Qt 5 or 6. xlnt is cross-platform user-friendly xlsx library for C++14.
Stars: ✭ 66 (+17.86%)
Mutual labels:  excel
xlsxd
A thin wrapper around libxlsx to write excel spreadsheets
Stars: ✭ 16 (-71.43%)
Mutual labels:  excel
Spreadsheet Excel Writer
Allows writing of Excel spreadsheets. Since 2002.
Stars: ✭ 42 (-25%)
Mutual labels:  excel
Samples-JS-PHP
JavaScript and PHP samples for Stimulsoft Reports.PHP reporting tool.
Stars: ✭ 17 (-69.64%)
Mutual labels:  excel
web-pivot-table
A feature-rich JS pivot grid library for creating interactive reports. Integrates with any front-end technology
Stars: ✭ 35 (-37.5%)
Mutual labels:  excel
flutter filereader
Flutter实现的本地文件(pdf word excel 等)查看插件,非在线预览
Stars: ✭ 101 (+80.36%)
Mutual labels:  excel
exceltricks
My commonly used Excel and Google Sheet formulas and tricks
Stars: ✭ 87 (+55.36%)
Mutual labels:  excel
English-Persian-Word-Database
English Persian Word Database - Popular database extensions
Stars: ✭ 19 (-66.07%)
Mutual labels:  excel
xls2db
Export table data from excel to mysql database, implemented with python.
Stars: ✭ 33 (-41.07%)
Mutual labels:  excel
ExcelUtil
Excel utility for Java to read and write data in declarative way.
Stars: ✭ 27 (-51.79%)
Mutual labels:  excel
easy-excel
excel导入和导出操作简化,同时支持xls和xlsx
Stars: ✭ 14 (-75%)
Mutual labels:  excel
luban
你的最佳游戏配置解决方案 {excel, csv, xls, xlsx, json, bson, xml, yaml, lua, unity scriptableobject} => {json, bson, xml, lua, yaml, protobuf(pb), msgpack, flatbuffers, erlang, custom template} data + {c++, java, c#, go(golang), lua, javascript(js), typescript(ts), erlang, rust, gdscript, protobuf schema, flatbuffers schema, custom template} code。
Stars: ✭ 1,660 (+2864.29%)
Mutual labels:  excel
lazyExcel
a simply software like MS-Excel.it can be running muiti-platform...
Stars: ✭ 37 (-33.93%)
Mutual labels:  excel
spreadsheet
TypeScript/javascript spreadsheet parser, with formulas.
Stars: ✭ 40 (-28.57%)
Mutual labels:  excel
VBA-and-Excel-Books-and-PDFs
Personal collection of vb.net, .net, vba and other books regarding vb programming
Stars: ✭ 83 (+48.21%)
Mutual labels:  excel
LocalizationUE4
Translation Editor for Unreal Engine 4
Stars: ✭ 59 (+5.36%)
Mutual labels:  excel
easy-excel
🚀 快速读写Excel文件,简单高效
Stars: ✭ 118 (+110.71%)
Mutual labels:  excel
xlsx-reader
xlsx-reader is a PHP library for fast and efficient reading of XLSX spreadsheet files. Its focus is on reading the data contained within XLSX files, disregarding all document styling beyond that which is strictly necessary for data type recognition. It is built to be usable for very big XLSX files in the magnitude of multiple GBs.
Stars: ✭ 40 (-28.57%)
Mutual labels:  excel

导表工具

项目主页:https://github.com/youlanhai/ExcelToCode

Excel文件:

转换后的python数据表:

# -*- coding: utf-8 -*-
# 此文件由导表工具自动生成,禁止手动修改。
# from example.xlsx

# A ID                  编号
# B name                名称
# C describe            描述
# D quality             品质
# E drop                掉落关卡
main_sheet = {
    1: {"describe": "切菜用的", "drop": [1, 2, 3, 4, ], "name": "菜刀", "quality": 1, },
    2: {"drop": [2, ], "name": "上方宝剑", "quality": 5, },
    3: {"name": "偃月弯刀", "quality": 0, },
}

原理

  1. 构造exporter对象,开始整个导表流程
  2. 搜索INPUT_PATH路径下的所有Excel文件
  3. 构造parser对象,将Excel数据转换成python格式的中间数据表
  4. 如果定义了后处理操作,exporter将对数据表执行后处理操作。比如表头合并,合法性检查
  5. 实例化writer对象,将python表转换成最终的python、lua、json等格式的数据表。

准备

  • python 2.7
  • 安装python插件openpyxl。使用pip install openpyxl安装,或者在config文件配置DEPENDENCIES项,指定openpyxl的安装包路径,导表工具会自动安装。

工具用法

python main.py --export your_configure_file
main导表参数 说明
config_file python格式的配置文件。配置文件的详细写法,参考配置文件参数详解
--gen-code 生成类代码,目前仅支持Java。需要在config文件中,指定代码生成器参数CODE_GENERATORS
--export 执行导表
--fast-mode 快速模式,仅重新解析最近修改过的Excel表。解析Excel表的过程非常慢,快速模式会使用已经生成的中间文件来避免二次解析Excel表
--force-run 出错后是否继续进行导表。常用于发现更多的错误
--gen-header 根据转换器描述信息,自动生成表头

范例

samples目录。direct-mode目录下的例子使用的是直接模式(Direct)config-mode目录下的例子使用的是配置模式(Config)mix-mode目录下的例子使用的是混合模式(Mix)

文件名称 描述
config.py 导表工具配置文件
export.bat/export.sh 导表批处理文件
excels 存放excel文件所在目录
converters 转换器父级目录
converters/converter 转换器脚本存放路径

文档

  1. 配置文件参数详解
  2. 表格添加方法

路径说明

路径 说明
codegen 代码生成器。如,生成Java代码
doc 文档
exporters 导出器。用于将excel表转换成相应的数据结构
parsers excel解析器。解析单个excel表格
postprocess 后处理器。导表结束后,可以执行一些额外的操作。比如,移动文件目录,生成文件列表等
samples 一些例子
tps 通用类型转换器。用于将数据转换成具体的Python数据类型
writers 写出器。用于将Python数据表,写出成不同格式的数据表。如,Lua、Json等。
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].