1

How to get cell address when cell is null?

lets say i have the following excel

  A B C D
1 x x x x
2 x x   x
3 x x x x

When I am iterating inside a row over columns something like:

    for (i in 0 until lastCellNum) {
     val cell = row.getCell(i)
     if (cell != null){
       println(cell.address)
     } else {
       println("cell data is missing at address: "+ //address_calculation)
     }    
    }

How to print this?:

"cell data is missing at address: C2"

beatrice
  • 3,684
  • 5
  • 22
  • 49
  • Fetch with a missing cell policy of https://poi.apache.org/apidocs/dev/org/apache/poi/ss/usermodel/Row.MissingCellPolicy.html#CREATE_NULL_AS_BLANK then you'll always get a blank cell back? – Gagravarr Nov 29 '22 at 14:05
  • this will put the cell into the sheet which I want to avoid – beatrice Nov 29 '22 at 14:53

1 Answers1

0

If I create a celladdress by hand it will calculate it:

CellAddress(rowIndex,colIndex).formatAsString
beatrice
  • 3,684
  • 5
  • 22
  • 49