// SPDX-License-Identifier: MIT OR Apache-2.0
//
// Copyright 2022-2026, John McNamara, jmcnamara@cpan.org
//! The following example demonstrates writing an array of row arrays to a
//! worksheet.
use rust_xlsxwriter::{Workbook, XlsxError};
fn main() -> Result<(), XlsxError> {
// Create a new Excel file object.
let mut workbook = Workbook::new();
// Add a worksheet to the workbook.
let worksheet = workbook.add_worksheet();
// Some array data to write.
let data = [
[10, 11, 12, 13, 14],
[20, 21, 22, 23, 24],
[30, 31, 32, 33, 34],
];
// Write the array data as a series of rows.
worksheet.write_row_matrix(0, 0, data)?;
workbook.save("worksheet.xlsx")?;
Ok(())
}