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

XLSX Get Sheet Names

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

Chilkat Rust Downloads

Rust

// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

// .xlsx files are Zip archives
let zip = chilkat::Zip::new();
if zip.open_zip("qa_data/excel/fakeCompanies.xlsx").is_err() {
    println!("{}", zip.last_error_text());
    return;
}

let csv = chilkat::Csv::new();
let sheet_names = chilkat::StringTable::new();
if csv.xlsx_get_sheets(&zip, &sheet_names).is_err() {
    println!("{}", csv.last_error_text());
    return;
}

let mut i = 0;
while i < sheet_names.count() {
    println!("{}", sheet_names.string_at(i).unwrap_or_default());
    i = i + 1;
}