PHP ActiveX
PHP ActiveX
XLSX Get Sheet Names
Open an Excel spreadsheet (.xlsx) and get the names of the sheets.Chilkat PHP ActiveX Downloads
<?php
$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
$zip = new COM("Chilkat.Zip");
$success = $zip->OpenZip('qa_data/excel/fakeCompanies.xlsx');
if ($success == 0) {
print $zip->LastErrorText . "\n";
exit;
}
$csv = new COM("Chilkat.Csv");
$sheetNames = new COM("Chilkat.StringTable");
$success = $csv->XlsxGetSheets($zip,$sheetNames);
if ($success == 0) {
print $csv->LastErrorText . "\n";
exit;
}
$i = 0;
while ($i < $sheetNames->Count) {
print $sheetNames->stringAt($i) . "\n";
$i = $i + 1;
}
?>