Dart Requires Chilkat v11.3.0+
Dart
XLSX Get Sheet Names
Open an Excel spreadsheet (.xlsx) and get the names of the sheets.Chilkat Dart Downloads
import 'package:chilkat/chilkat.dart';
void main() {
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
// .xlsx files are Zip archives
final zip = CkZip();
try {
zip.openZip('qa_data/excel/fakeCompanies.xlsx');
} on ChilkatException catch (e) {
print(e.lastErrorText);
return;
}
final csv = CkCsv();
final sheetNames = CkStringTable();
try {
csv.xlsxGetSheets(zip, sheetNames);
} on ChilkatException catch (e) {
print(e.lastErrorText);
return;
}
var i = 0;
while (i < sheetNames.count) {
print(sheetNames.stringAt(i));
i++;
}
}