Lua Requires Chilkat v11.3.0+
Lua
XLSX Get Sheet Names
Open an Excel spreadsheet (.xlsx) and get the names of the sheets.Chilkat Lua Downloads
local chilkat = require("chilkat")
-- This example assumes the Chilkat API to have been previously unlocked.
-- See Global Unlock Sample for sample code.
-- .xlsx files are Zip archives
local zip = chilkat.Zip.new()
local success = zip:open_zip("qa_data/excel/fakeCompanies.xlsx")
if not success then
print(zip.last_error_text)
return
end
local csv = chilkat.Csv.new()
local sheetNames = chilkat.StringTable.new()
success = csv:xlsx_get_sheets(zip, sheetNames)
if not success then
print(csv.last_error_text)
return
end
local i = 0
while i < sheetNames.count do
print(sheetNames:string_at(i))
i = i + 1
end