Chilkat2-Python
Chilkat2-Python
XLSX Get Sheet Names
Open an Excel spreadsheet (.xlsx) and get the names of the sheets.Chilkat Chilkat2-Python Downloads
import sys
import chilkat2
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 = chilkat2.Zip()
success = zip.OpenZip("qa_data/excel/fakeCompanies.xlsx")
if (success == False):
print(zip.LastErrorText)
sys.exit()
csv = chilkat2.Csv()
sheetNames = chilkat2.StringTable()
success = csv.XlsxGetSheets(zip,sheetNames)
if (success == False):
print(csv.LastErrorText)
sys.exit()
i = 0
while i < sheetNames.Count :
print(sheetNames.StringAt(i))
i = i + 1