Sample code for 30+ languages & platforms
PHP Extension

XLSX Get Sheet Names

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

Chilkat PHP Extension Downloads

PHP Extension
<?php

include("chilkat.php");

$success = false;

// 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 CkZip();
$success = $zip->OpenZip('qa_data/excel/fakeCompanies.xlsx');
if ($success == false) {
    print $zip->lastErrorText() . "\n";
    exit;
}

$csv = new CkCsv();
$sheetNames = new CkStringTable();
$success = $csv->XlsxGetSheets($zip,$sheetNames);
if ($success == false) {
    print $csv->lastErrorText() . "\n";
    exit;
}

$i = 0;
while ($i < $sheetNames->get_Count()) {
    print $sheetNames->stringAt($i) . "\n";
    $i = $i + 1;
}


?>