JavaScript
JavaScript
XLSX Get Sheet Names
Open an Excel spreadsheet (.xlsx) and get the names of the sheets.
Note
This example is intended for running within a Chilkat.Js embedded JavaScript engine. All Chilkat JavaScript examples require Chilkat
v11.4.0 or greater.
var 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
var zip = new CkZip();
success = zip.OpenZip("qa_data/excel/fakeCompanies.xlsx");
if (success == false) {
console.log(zip.LastErrorText);
return;
}
var csv = new CkCsv();
var sheetNames = new CkStringTable();
success = csv.XlsxGetSheets(zip,sheetNames);
if (success == false) {
console.log(csv.LastErrorText);
return;
}
var i = 0;
while (i < sheetNames.Count) {
console.log(sheetNames.StringAt(i));
i = i+1;
}