CkPython
CkPython
XLSX Get Sheet Names
Open an Excel spreadsheet (.xlsx) and get the names of the sheets.Chilkat CkPython Downloads
import sys
import 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()
success = zip.OpenZip("qa_data/excel/fakeCompanies.xlsx")
if (success == False):
print(zip.lastErrorText())
sys.exit()
csv = chilkat.CkCsv()
sheetNames = chilkat.CkStringTable()
success = csv.XlsxGetSheets(zip,sheetNames)
if (success == False):
print(csv.lastErrorText())
sys.exit()
i = 0
while i < sheetNames.get_Count() :
print(sheetNames.stringAt(i))
i = i + 1