MathNya / umya-spreadsheet

A pure rust library for reading and writing spreadsheet files
MIT License
238 stars 41 forks source link

Need help on creating List cells using data validation #178

Closed BharathIO closed 4 months ago

BharathIO commented 4 months ago

Hi, I am creating Excel with 2 sheets, One to create a List of values and the other to point values to display drop-down.

But calling get_data_validations() returns None. When I try to read validations from the existing Excel template and write to output a new file, my output workbook does not have any validations. Looks like they are not getting copied/cloned, could you please check and do the needful? I am attaching excel template for reference

Screenshot 2024-02-14 at 3 18 29 PM Screenshot 2024-02-14 at 3 21 12 PM

My requirement is to read that excel, fill in actual data, and create an output file. But because of missing data validations, my output file is getting corrupted, and opening in recovery mode does not have any validations.

Excel file

lov-template.xlsx

MathNya commented 4 months ago

@BharathIO Thank you for contacting us. We will address this in the next version of the software.

BharathIO commented 4 months ago

Thanks for the update @MathNya , may i know when can i expect next version with the above fixes?

MathNya commented 4 months ago

@BharathIO We will probably be able to release it around the end of this month.

BharathIO commented 4 months ago

Sure. I will be waiting for that feature. Hope it takes care of defined named ranges for Lists read/write.

BharathIO commented 4 months ago

I see we are facing issue when named range is creating like below.

=OFFSET(LOV!$A$1,1,0,COUNTIF(LOV!$A:$A,"<>"&"")-1,1)

BharathIO commented 4 months ago

Fyi, this is what i observed.

Screenshot 2024-02-20 at 11 33 48 AM Screenshot 2024-02-20 at 11 31 34 AM
MathNya commented 4 months ago

@BharathIO We have released 1.2.1 which fixes this problem. Please check it out.

BharathIO commented 4 months ago

After version upgrade, i am facing issue mentioned here https://github.com/MathNya/umya-spreadsheet/issues/181#issuecomment-1968439976, could you please check for it?

BharathIO commented 4 months ago

I am still facing this issue after upgrading to 1.2.2. could you please check

Output file

Employees (8).xlsx

Screenshot 2024-02-28 at 4 04 05 PM
BharathIO commented 4 months ago

Input file

lov-template-input.xlsx

Output file

1_lov_copy.xlsx

let template_path = "../lov-template-input.xlsx";
    let output_path = "../1_lov_copy.xlsx";
    let book = umya_spreadsheet::reader::xlsx::read(template_path).unwrap();

    let path = std::path::Path::new(output_path);
    let _ = umya_spreadsheet::writer::xlsx::write(&book, path);
    println!("File cloned successfully at: {}", output_path);
BharathIO commented 4 months ago

Hi @MathNya, did you get a chance to check above issue? Please correct if i am doing anything wrong

MathNya commented 4 months ago

@BharathIO Sorry for the delay in contacting you. I will check the situation.

MathNya commented 4 months ago

@BharathIO We were able to correct the cause of the error. Version 1.2.3 was released. Please check it out.

BharathIO commented 4 months ago

Thanks, @MathNya, it is working as expected now.

Screenshot 2024-03-01 at 4 27 10 PM Screenshot 2024-03-01 at 4 27 25 PM Screenshot 2024-03-01 at 4 27 35 PM

Excel for reference

Employees (11).xlsx