Sample code for 30+ languages & platforms
Lianja

XLSX Get Sheet Names

Open an Excel spreadsheet (.xlsx) and get the names of the sheets.

Chilkat Lianja Downloads

Lianja
llSuccess = .F.

// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

// .xlsx files are Zip archives
loZip = createobject("CkZip")
llSuccess = loZip.OpenZip("qa_data/excel/fakeCompanies.xlsx")
if (llSuccess = .F.) then
    ? loZip.LastErrorText
    release loZip
    return
endif

loCsv = createobject("CkCsv")
loSheetNames = createobject("CkStringTable")
llSuccess = loCsv.XlsxGetSheets(loZip,loSheetNames)
if (llSuccess = .F.) then
    ? loCsv.LastErrorText
    release loZip
    release loCsv
    release loSheetNames
    return
endif

i = 0
do while i < loSheetNames.Count
    ? loSheetNames.StringAt(i)
    i = i + 1
enddo


release loZip
release loCsv
release loSheetNames