https://github.com/xiyoo0812/luaxlsx
一个使用lua解析excel的xlsx/xlsm格式的库。
https://github.com/xiyoo0812/luaxlsx
excel lua xlsm xlsx
Last synced: 12 months ago
JSON representation
一个使用lua解析excel的xlsx/xlsm格式的库。
- Host: GitHub
- URL: https://github.com/xiyoo0812/luaxlsx
- Owner: xiyoo0812
- Created: 2020-07-02T06:11:29.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2025-03-03T09:06:38.000Z (over 1 year ago)
- Last Synced: 2025-05-07T08:58:31.027Z (about 1 year ago)
- Topics: excel, lua, xlsm, xlsx
- Language: C
- Homepage:
- Size: 423 KB
- Stars: 16
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# luaxlsx
一个使用lua解析excel的xlsx/xlsm格式的库。
# 依赖
- miniz (已经包含在库内)
- [lua](https://github.com/xiyoo0812/lua.git)5.2以上
- [luakit](https://github.com/xiyoo0812/luakit.git)一个luabind库
- 项目路径如下
|--proj
|--lua
|--luaxlsx
|--luakit
# 编译
- msvc: 准备好lua依赖库并放到指定位置,将proj文件加到sln后编译。
- linux: 准备好lua依赖库并放到指定位置,执行make -f luaxlsx.mak
# 注意事项
- mimalloc: 参考[quanta](https://github.com/xiyoo0812/quanta.git)使用,不用则在工程文件中注释
# 用法
```lua
local lexcel = require('luaxlsx')
local workbook = lexcel.open(full_name)
if not workbook then
rint(sformat("open excel %s failed!", file))
return
end
--只导出sheet1
local sheets = workbook.sheets()
local sheet = sheets and sheets[1]
--sheet_name
local sheet_name = sheet.name
for row = dim.first_row_, dim.last_row_ do
for col = dim.first_col_, dim.last_col_ do
local cell = sheet.get_cell(row, col)
print(cell.type, cell.value)
end
end
```