From 48d31fe09e6a753a433358c9ce73c980bbd4380e Mon Sep 17 00:00:00 2001 From: Luka Peschke Date: Mon, 1 Jul 2024 12:04:34 +0200 Subject: [PATCH] fix: treat #REF! cells as nulls Signed-off-by: Luka Peschke --- python/tests/fixtures/sheet-with-na.xlsx | Bin 8927 -> 7283 bytes python/tests/test_fastexcel.py | 14 ++++++++++++++ src/types/dtype.rs | 6 ++++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/python/tests/fixtures/sheet-with-na.xlsx b/python/tests/fixtures/sheet-with-na.xlsx index e098fc93705b1447e98d5bdb45b7e15f37cc6ce9..f5b0bd862ea3b2a320d2458eb1d7fa9c4e2f0d9e 100644 GIT binary patch literal 7283 zcmbVRWmr@Tx2C(L8>vA$6_ikr?(WWEV1OYdloF6mk#0!|X&Aa?C;{m%N$C=};CG%Y z$NQc0N z?sg!KyKkT|Fkm|uUcjCQM)|33^`$sV0)!<{U+)w?0Gc3i6r^dFTEoeZ>qwhOEwA)t zz+}zLDtTvx?Xp9H$sJxp1wnj1sMVcu0qR-j5n$I~V>sLg@?*ApSl+9ngy1}|9|GCr z7m|4yyuobM9hK6r9+2Z6cV+l!#YIQt2jA(NleX9$6nLA*>Mix+9nJ1Rj(ox*LD%h> zgIW*W$2ah_nPc177HZQv3KLV1eNruYX6Lc894cDHz$$3t)*1qcaB#~1XfNFV z*z3Nf!d3UcQ(SmgP0elfdr?RL#DD@_3}Eh6K8CI6(}6(uC$8o+jG(C-kxn|QuX#2` zrk5P2yU>Qm&7b68hQl5f*g-ioh~o5idHoUX?|14S!>`FC%3Iq;wWAB`bI!pc$9L3h zPm4LK_9-#4fW$8iiM282YlxESN9$a2Y3FO~NzVH+d%S$5b0bh3pGC-KVpXE?o{EwR z490gnWyNJA2R^3+KJOzp%I|A8O=AroETLs8+>8Z8x2syC4=;tEWSbR4U5Zy}k_)c9 z@I+d}^!%CP^HL_we~4V02`$#<*{07qb{j!o9;7nyv9DF2)D7$WGsGpR%Vsh^!;z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}uob|3J*)-=WoMYKW152tNvh z;DP(+@Uw7n`Cs%QrtDuOD^blEq5FjIqg>Ho%~J?FYGH*`SSmd^skTH)^t4tldX`tq z7+LXZXIi6vZ1St;Y#a@@sl?loJ)CTIUsbEHcinDU(a12&y3=cr*giFvWK1ZjKQ@f_80MMDrH}whF zhyC#5hJ6M1w|-64`0|{)=?^&1m-5r*d7hhBwsmh*APv8p)c8^$mAAZt8GA}u!r4ZR zCBn4MnqmC2 zANM+uD)7Y_ALQ^Y(Pk#{c)k+aq@jap$Mh9g5vzXU$+BOsfsGAnC4@ni&4D4SJ;E!) zwX#|uU zaAN!~m+0!-5=4{F7OdRD`kPVPd#_B6y`Bk$rEPvWJ@V8tO}jL+7GRRBGP?Uu#u5pc z6F~<5{3*e|SMA^JKYUoAsq$9`e@%M++wfTNStAk%Roqssc zBKc3p|F#AF)yuCO|A!YA^4~}BE93v_;jc{khdlsrj{*Sr8?XLq{?{krpUuOl{$&2I Y=c1+xDq?j3fcuDFFoL?3X@8#mA6PJkasU7T diff --git a/python/tests/test_fastexcel.py b/python/tests/test_fastexcel.py index 69660a9..632a491 100644 --- a/python/tests/test_fastexcel.py +++ b/python/tests/test_fastexcel.py @@ -477,6 +477,20 @@ def test_sheet_with_na(): pl_assert_frame_equal(sheet.to_polars(), pl.DataFrame(expected)) +def test_sheet_with_ref(): + """Test reading a sheet with #REF! cells. For now, we consider them as null""" + excel_reader = fastexcel.read_excel(path_for_fixture("sheet-with-na.xlsx")) + sheet = excel_reader.load_sheet("Broken refs") + + assert sheet.name == "Broken refs" + assert sheet.height == sheet.total_height == 2 + assert sheet.width == 1 + + expected = {"numbers": [1.0, None]} + pd_assert_frame_equal(sheet.to_pandas(), pd.DataFrame(expected)) + pl_assert_frame_equal(sheet.to_polars(), pl.DataFrame(expected)) + + @pytest.mark.parametrize("excel_file", ["sheet-null-strings.xlsx", "sheet-null-strings-empty.xlsx"]) def test_null_strings(excel_file: str): excel_reader = fastexcel.read_excel(path_for_fixture(excel_file)) diff --git a/src/types/dtype.rs b/src/types/dtype.rs index dfbeecc..1f30306 100644 --- a/src/types/dtype.rs +++ b/src/types/dtype.rs @@ -159,8 +159,10 @@ fn get_cell_dtype( Ok(DType::Null) } else if cell.is_error() { match cell.get_error() { - // considering cells with #N/A! as null - Some(CellErrorType::NA | CellErrorType::Value | CellErrorType::Null) => Ok(DType::Null), + // considering cells with #N/A! or #REF! as null + Some( + CellErrorType::NA | CellErrorType::Value | CellErrorType::Null | CellErrorType::Ref, + ) => Ok(DType::Null), Some(err) => Err(FastExcelErrorKind::CalamineCellError(err.to_owned()).into()), None => Err(FastExcelErrorKind::Internal(format!( "cell is an error but get_error returned None: {cell:?}"