The Workbook struct

The Workbook struct represents an Excel file in it's entirety. It is the starting point for creating a new Excel xlsx file.

// SPDX-License-Identifier: MIT OR Apache-2.0
//
// Copyright 2022-2024, John McNamara, jmcnamara@cpan.org

//! The following example demonstrates creating a simple workbook, with one
//! unused worksheet.

use rust_xlsxwriter::{Workbook, XlsxError};

fn main() -> Result<(), XlsxError> {
    let mut workbook = Workbook::new();

    let _worksheet = workbook.add_worksheet();

    workbook.save("workbook.xlsx")?;

    Ok(())
}

Image of output from doc_workbook_new.rs

For more details on the Workbook APIs see the docs.rs docs for Workbook.