1
我有以下代码如何使用luacom读取xlsx文件?
excel = luacom.CreateObject("Excel.Application")
pcall(excel.Open, excel, "1.xlsx")
if excel ~= nil then
sheets = excel.Worksheets
sheet1 = sheets:Item(1)
for row=1, 30 do
for col=1, 30 do
local cellValue = sheet1.Cells(row, col).Value2
if cellValue ~= nil then
--print(cellValue)
end
end
end
end
如何修改它,以便能够读取Excel文件,导致目前练成变量不持有任何workshett,并seemd像装载不顺利。