Xbase++ Requires Chilkat v11.3.0+
Xbase++
XLSX Get Sheet Names
Open an Excel spreadsheet (.xlsx) and get the names of the sheets.Chilkat Xbase++ Downloads
LOCAL nSuccess
LOCAL oZip
LOCAL oCsv
LOCAL oSheetNames
LOCAL i
nSuccess := 0
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
// .xlsx files are Zip archives
oZip := CreateObject("Chilkat.Zip")
nSuccess := oZip:OpenZip("qa_data/excel/fakeCompanies.xlsx")
IF (nSuccess == 0)
? oZip:LastErrorText
oZip:destroy()
RETURN
ENDIF
oCsv := CreateObject("Chilkat.Csv")
oSheetNames := CreateObject("Chilkat.StringTable")
nSuccess := oCsv:XlsxGetSheets(oZip, oSheetNames)
IF (nSuccess == 0)
? oCsv:LastErrorText
oZip:destroy()
oCsv:destroy()
oSheetNames:destroy()
RETURN
ENDIF
i := 0
DO WHILE i < oSheetNames:Count
? oSheetNames:StringAt(i)
i := i + 1
ENDDO
oZip:destroy()
oCsv:destroy()
oSheetNames:destroy()