informationsea / xlsxwriter-rs

Excel file writer for Rust
https://crates.io/crates/xlsxwriter
Apache License 2.0
265 stars 44 forks source link

Not able to export the huge data (more than 32767 characters) #46

Closed SiriIO closed 1 year ago

SiriIO commented 1 year ago
use xlsxwriter::{ Workbook};

fn main() -> Result<(), xlsxwriter::XlsxError> {
    let workbook = Workbook::new("target/test.xlsx")?;

    let mut sheet1 = workbook.add_worksheet(None)?;

    sheet1.write_string(
        1,
        0,
       "more than 32767 characters string",
        None,
    )?;

    workbook.close()
}

Getting below error

Error: XlsxError { source: LibXlsxWriter(21) } The terminal process "cargo 'run', '--package', 'hello-rust', '--bin', 'hello-rust'" terminated with exit code: 1.

Screenshot 2023-03-02 at 5 31 42 PM
jmcnamara commented 1 year ago

Maybe you are posting this issue in relation to the error message but Excel has a hard limit of 32767 characters in a cell. There is no workaround for that.

informationsea commented 1 year ago

As jmcnamara says, this is excel limitation that described in https://support.microsoft.com/en-us/office/excel-specifications-and-limits-1672b34d-7043-467e-8e27-269d656771c3