ToucanToco / fastexcel

A Python wrapper around calamine
http://fastexcel.toucantoco.dev/
MIT License
120 stars 6 forks source link

Xlsx Chart Sheet Crash #235

Closed Tim-Kracht closed 4 months ago

Tim-Kracht commented 6 months ago

When loading a chart worksheet, load_sheet_by_name raises:

Exception has occurred: CalamineError
* 
calamine error: Xlsx error: Unexpected end of xml, expecting '</sheetData>'
Context:
    0: Error while loading sheet Chart1
  File "/Users/me/Source/test.py", line 17, in _get_worksheet_info
    ws = wb.load_sheet_by_name(name=sheet_name, header_row=header_row, schema_sample_rows=1)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_fastexcel.CalamineError: calamine error: Xlsx error: Unexpected end of xml, expecting '</sheetData>'
Context:
    0: Error while loading sheet Chart1

chart.xlsx

lukapeschke commented 6 months ago

Hi @Tim-Kracht thanks for the bug report! Indeed, I can reproduce, but this appears to be an issue with calamine, as I also have the problem with the following rust code:

use calamine::{open_workbook, Reader, Xlsx};

fn main() {
    let mut workbook: Xlsx<_> = open_workbook("chart.xlsx").expect("could not open workbook");
    let range = workbook
        .worksheet_range("Chart1")
        .expect("could not open worksheet range");
}
thread 'main' panicked at examples/bug_235.rs:7:10:
could not open worksheet range: XmlEof("sheetData")
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Could you please open an issue in the calamine repo so we can track progress here ? Thanks!

Tim-Kracht commented 6 months ago

https://github.com/tafia/calamine/issues/438

tafia commented 4 months ago

Should be fixed now.

PrettyWood commented 4 months ago

Solved upstream (see https://github.com/tafia/calamine/pull/450). Thanks @tafia