Cell values are mapped to incorrect keys in Hash mode
myabc opened this issue · 3 comments
myabc commented
To reproduce:
Parsing the following file complex-headers.xlsx
@sheet = Xsv.open("./complex-headers.xlsx").sheets[0]
@sheet.parse_headers!
p @sheet[0]
Expected
{nil=>nil, "Customer nr."=>537066, "Customer name"=>"Unilever", "Item number"=>391790102, "Description"=>"Soap", "Qty outst."=>6, "Another Ref"=>"18-01-2024", "Reference"=>"#JL-65568", "Site address"=>"5 Cross Street", "Zdepot"=>"GG"}
Actual
=> {nil=>"GG", "Customer nr."=>nil, "Customer name"=>537066, "Item number"=>"Unilever", "Description"=>391790102, "Qty outst."=>"Soap", "Another Ref"=>6, "Reference"=>"18-01-2024", "Site address"=>"#JL-65568", "Zdepot"=>"5 Cross Street"}
See #55 for a failing test case.
martijn commented
Thanks for reporting and submitting a test case. The situation of multiple headers with nil
values was always a bit messy. Can you see if the fix in #57 works for you?
myabc commented
Hoi @martijn. Thanks for looking into this and coming up with a fix so quickly! I've tested with a real-world .xlsx file that was previously failing and this fixes the issue. 👍🏻 Dank je wel!
martijn commented
Fix released in Xsv 1.3.1