PHP Requires Chilkat v11.3.0+
Chilkat2 PHP
XLSX Get Sheet Names
Open an Excel spreadsheet (.xlsx) and get the names of the sheets.Chilkat PHP Downloads
<?php
use Chilkat2\Csv;
use Chilkat2\StringTable;
use Chilkat2\Zip;
// 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 Zip();
try {
$zip->OpenZip('qa_data/excel/fakeCompanies.xlsx');
$csv = new Csv();
$sheetNames = new StringTable();
$csv->XlsxGetSheets($zip, $sheetNames);
} catch (\Chilkat2\Exception $e) {
echo $e->getMessage(), "\n";
exit;
}
$i = 0;
while ($i < $sheetNames->Count) {
echo $sheetNames->StringAt($i), "\n";
$i = $i + 1;
}