tafia / calamine

A pure Rust Excel/OpenDocument SpreadSheets file reader: rust on metal sheets
MIT License
1.6k stars 155 forks source link

Isssue with load_tables and table_names functions #401

Closed DarkwingDuck48 closed 4 months ago

DarkwingDuck48 commented 4 months ago

Please, help me!

When I try to parse xlsx file with smart table inside, functions load_table and table_names work good. But when I try to parse xlsx file without smart table inside the same code failed with error "Tables must be loaded before they are referenced"

    let mut workbook: Xlsx<_> = open_workbook(cli.source_file).expect("Cannot open file");

    // Get worksheets of a book
    let worksheets: Vec<String> = workbook.sheet_names();
    workbook.load_tables().unwrap();
    let tables = workbook.table_names();
    println!("Tables loaded");
    println!("Defined Tables: {:?}", tables);

I can't figured out how to check if it is any tables in the file.

tafia commented 4 months ago

This is a legit bug.

tafia commented 4 months ago

I have a fix but I need to get a file to test on.

tafia commented 4 months ago

Closing it, one of the files we're already using for tests was exhibiting that behavior.

DarkwingDuck48 commented 4 months ago

It works. thank you!!

tafia commented 4 months ago

Thanks for reporting the bug!