Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Read the particular row/record from Excel and output as HTML table

 
Rajesh Balu
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,


I want to read the data from the excel sheet and to display it in the HTML table as output.

I want to read a specific row from the excel based some unique value. (Say an example of EmpID).

I have tried the below code:

FileInputStream fileInputStream = new FileInputStream("d:/Test.xls");
HSSFWorkbook workbook = new HSSFWorkbook(fileInputStream);
HSSFSheet worksheet = workbook.getSheet("Test");
HSSFRow row1 = worksheet.getRow(0);
HSSFCell cellA1 = row1.getCell((short) 0);
String a1Val = cellA1.getStringCellValue();
HSSFCell cellB1 = row1.getCell((short) 1);
String b1Val = cellB1.getStringCellValue();
HSSFCell cellC1 = row1.getCell((short) 2);
String c1Val = cellC1.getStringCellValue();


Using this i can retrieve the first row of the excel. But i want to read the particular column based on the key value.

Could someone please help me?


Thanks,
Rajesh.B
 
Rajesh Balu
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,


I am still struggling with this issue.

Could someone please help me on this?


Thanks,
Rajesh.B
 
Tim Moores
Bartender
Posts: 2947
46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i want to read the particular column based on the key value.

What does that mean?
 
Rajesh Balu
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It means, to search the record based on some unique value.

Example; It there is a table of values with emp name, emp id, emp address, i want to fetch the record based on the emp id.

Hope this clarifies your question.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic