Sample code for 30+ languages & platforms
Perl

XLSX Get Sheet Names

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

Chilkat Perl Downloads

Perl
use chilkat();

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

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

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