Ruby
Ruby
XLSX Get Sheet Names
Open an Excel spreadsheet (.xlsx) and get the names of the sheets.Chilkat Ruby Downloads
require 'chilkat'
success = false
# This example assumes the Chilkat API to have been previously unlocked.
# See Global Unlock Sample for sample code.
# .xlsx files are Zip archives
zip = Chilkat::CkZip.new()
success = zip.OpenZip("qa_data/excel/fakeCompanies.xlsx")
if (success == false)
print zip.lastErrorText() + "\n";
exit
end
csv = Chilkat::CkCsv.new()
sheetNames = Chilkat::CkStringTable.new()
success = csv.XlsxGetSheets(zip,sheetNames)
if (success == false)
print csv.lastErrorText() + "\n";
exit
end
i = 0
while i < sheetNames.get_Count()
print sheetNames.stringAt(i) + "\n";
i = i + 1
end