(Classic ASP) 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.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
success = 0
' This example assumes the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.
' .xlsx files are Zip archives
set zip = Server.CreateObject("Chilkat.Zip")
success = zip.OpenZip("qa_data/excel/fakeCompanies.xlsx")
If (success = 0) Then
Response.Write "<pre>" & Server.HTMLEncode( zip.LastErrorText) & "</pre>"
Response.End
End If
set csv = Server.CreateObject("Chilkat.Csv")
set sheetNames = Server.CreateObject("Chilkat.StringTable")
success = csv.XlsxGetSheets(zip,sheetNames)
If (success = 0) Then
Response.Write "<pre>" & Server.HTMLEncode( csv.LastErrorText) & "</pre>"
Response.End
End If
i = 0
Do While i < sheetNames.Count
Response.Write "<pre>" & Server.HTMLEncode( sheetNames.StringAt(i)) & "</pre>"
i = i + 1
Loop
%>
</body>
</html>
|