Test empty cell in Taro package [maybe basic pointer manipulation]

Hi,
I’m using the Taro package to deal with excel sheets. I simply want to test if a cell is empty or not.

When Cell 1 in line r is not empty, getCell(r,1) returns something like
JavaCall.JavaObject{Symbol(“org.apache.poi.ss.usermodel.Cell”)}(Ptr{Void} @0x0000000004199608)

When Cell 2 and 3 are empty, both getCell(r,2) and getCell(r,3) return
JavaCall.JavaObject{Symbol(“org.apache.poi.ss.usermodel.Cell”)}(Ptr{Void} @0x0000000000000000)

But getCell(r,2)==getCell(r,3) is false, I wanted it to be true.
I used the dirty hack to compare string(getCell(r,2)) and string(JavaCall.JavaObject{Symbol(“org.apache.poi.ss.usermodel.Cell”)}(0)),
but there should be a better way.

Thanks in advance,

Olivier

Check isnull(getCell(r,2)) . That will return true when cell does not exist in the sheet.

Note that in some cases, for example, if you type a value into a cell, then delete it, it might look empty visually, but getCell will return a non-null value, but getValue will then return an empty string … Yes excel is wierd.

1 Like