public
void ReadFromXL()
{
File f = new
File("C:/Java_Source_Code/ARSystem.data.xls");
try {
Workbook workbook = Workbook.getWorkbook(f);
String[] sheetName = workbook.getSheetNames();
for (int i=0;i<sheetName.length;i++)
{
System.out.println(sheetName[i]);
}
} catch (IOException | BiffException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
- //get all the worksheet name
Workbook workbook = Workbook.getWorkbook(f);
Sheet sheetName = workbook.getSheet(0);
String sName = sheetName.getName();
System.out.println(sName);
- //get all cell contents for a
particular column
Cell[] columns = sheet.getColumn(0);
for (int i=0;i<columns.length;i++)
{
System.out.println(columns[i].getContents());
}
- //get content for a
particular cell
Cell cell = sheet.getCell(0, 0);
String cellContent =
cell.getContents();
System.out.println(cellContent);
- //get all cell contents for a
particular row
sheet.getRow(0);
No comments:
Post a Comment