C#
C#
XLSX Get Sheet Names
Open an Excel spreadsheet (.xlsx) and get the names of the sheets.Chilkat C# Downloads
bool 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
Chilkat.Zip zip = new Chilkat.Zip();
success = zip.OpenZip("qa_data/excel/fakeCompanies.xlsx");
if (success == false) {
Debug.WriteLine(zip.LastErrorText);
return;
}
Chilkat.Csv csv = new Chilkat.Csv();
Chilkat.StringTable sheetNames = new Chilkat.StringTable();
success = csv.XlsxGetSheets(zip,sheetNames);
if (success == false) {
Debug.WriteLine(csv.LastErrorText);
return;
}
int i = 0;
while (i < sheetNames.Count) {
Debug.WriteLine(sheetNames.StringAt(i));
i = i + 1;
}