(AutoIt) XLSX Get Sheet Names
Open an Excel spreadsheet (.xlsx) and get the names of the sheets. Note: This example requires Chilkat v11.3.0 or greater.
Local $bSuccess = False
; This example assumes the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
; .xlsx files are Zip archives
$oZip = ObjCreate("Chilkat.Zip")
$bSuccess = $oZip.OpenZip("qa_data/excel/fakeCompanies.xlsx")
If ($bSuccess = False) Then
ConsoleWrite($oZip.LastErrorText & @CRLF)
Exit
EndIf
$oCsv = ObjCreate("Chilkat.Csv")
$oSheetNames = ObjCreate("Chilkat.StringTable")
$bSuccess = $oCsv.XlsxGetSheets($oZip,$oSheetNames)
If ($bSuccess = False) Then
ConsoleWrite($oCsv.LastErrorText & @CRLF)
Exit
EndIf
Local $i = 0
While $i < $oSheetNames.Count
ConsoleWrite($oSheetNames.StringAt($i) & @CRLF)
$i = $i + 1
Wend
|