Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. log.info cell.getNumericCellValue()
  2. log.info cell.getStringCellValue()
  3.  
  4. import org.apache.poi.xssf.usermodel.*
  5.  
  6.  
  7. def fs = new FileInputStream("C:\File\Book2.xlsx")
  8. def wb = new XSSFWorkbook(fs)
  9. def ws = wb.getSheet("Sheet1")
  10. def r = ws.getPhysicalNumberOfRows()
  11.  
  12.  
  13. for(def i=0; i<r; i++){
  14.  
  15. def row = ws.getRow(i)
  16. def c = row.getPhysicalNumberOfCells()
  17.  
  18. for (def j=0; j<c; j++) {
  19.  
  20. def cell = row.getCell(j)
  21.  
  22. log.info cell.getStringCellValue()
  23. }
  24. }
  25.  
  26. java.lang.illegalStateException:Cannot get a STRING value from a NUMERIC cell
  27.  
  28. java.lang.illegalStateException:Cannot get a NUMERIC value from a STRING cell
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement