Sample code for 30+ languages & platforms
Delphi ActiveX Requires Chilkat v11.3.0+

XLSX Get Sheet Names

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

Chilkat Delphi ActiveX Downloads

Delphi ActiveX
var
success: Integer;
zip: TChilkatZip;
csv: TChilkatCsv;
sheetNames: TChilkatStringTable;
i: Integer;

begin
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 := TChilkatZip.Create(Self);
success := zip.OpenZip('qa_data/excel/fakeCompanies.xlsx');
if (success = 0) then
  begin
    Memo1.Lines.Add(zip.LastErrorText);
    Exit;
  end;

csv := TChilkatCsv.Create(Self);
sheetNames := TChilkatStringTable.Create(Self);
success := csv.XlsxGetSheets(zip.ControlInterface,sheetNames.ControlInterface);
if (success = 0) then
  begin
    Memo1.Lines.Add(csv.LastErrorText);
    Exit;
  end;

i := 0;
while i < sheetNames.Count do
  begin
    Memo1.Lines.Add(sheetNames.StringAt(i));
    i := i + 1;
  end;