Retrieve the cell's contents as a string

Retrieve the cell's contents as a string

Previous Home Next

 

 Now we will see how to retrieve the cell's contents as a string.

For reading the sheet contained in a workbook we have to use the jxl.read.biff package. 
 To retrieve the contents the cell of sheets we can use the getContents() method on the sheet. The following code snippet will demonstrate how to read the contents of the cell,

Workbook copyworkbook=Workbook.getWorkbook(new File("F:/JAVA PROJECTS/Jexcel/src/r4r/co/in/firstsheet.xls"));// opening an existing workbook
Sheet readsheet=copyworkbook.getSheet(0);    // getting sheet contained at 0th index in the workbook
System.out.println(copyworkbook.getSheet(0).getCell(0,1).getContents());  // getting the contents value in String format of the cell(0,1) in the sheet.
       
 


       


 

Previous Home Next