Retrieving specific data from excel
Hello everyone, i have written a simple code to retrieve data from excel sheet and working fine, the excel file contain heading for each row written in bold and the student details such as Sl.No, Name, Roll Number followed by it. I want only those students details to be printed. here is my sample code
try {
FileInputStream file = new FileInputStream(new File("d:/file.xls"));
//Get the workbook instance for XLS file
HSSFWorkbook workbook = new HSSFWorkbook(file);
//Get first sheet from the workbook
HSSFSheet sheet = workbook.getSheetAt(0);
//Iterate through each rows from first sheet
Iterator<Row> rowIterator = sheet.iterator();
while(rowIterator.hasNext()) {
Row row = rowIterator.next();
//For each row, iterate through each columns
Iterator<Cell> cellIterator = row.cellIterator();
while(cellIterator.hasNext()) {
Cell cell = cellIterator.next();
switch(cell.getCellType()) {
case Cell.CELL_TYPE_BOOLEAN:
System.out.print(cell.getBooleanCellValue() + "\t\t");
break;
case Cell.CELL_TYPE_NUMERIC:
System.out.print(cell.getNumericCellValue() + "\t\t");
break;
case Cell.CELL_TYPE_STRING:
System.out.print(cell.getStringCellValue() + "\t\t");
break;
}
}
System.out.println("");
}
file.close();
FileOutputStream out =
new FileOutputStream(new File("d:/file.xls"));
workbook.write(out);
out.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
}
can anyone help me out
View Answers
Ads
Related Tutorials/Questions & Answers:
Retrieving specific data from excel
Retrieving specific data from excel Hello everyone, i have written a simple code to retrieve
data from excel sheet and working fine, the
excel file... first sheet
from the workbook
HSSFSheet sheet = workbook.getSheetAt(0
retrieving excel data when file uploading
retrieving excel data when file uploading <%@page import...);
}
}
%>
when i gave full path name i got
excel data but when file uploading not getting the
excel data
Advertisements
Retrieving Data from Database to fill Combo Box
Retrieving Data from Database to fill Combo Box Sir,
I have a JSP Page with a combo box and a label. I have a database that has two fields id and an image. Now I want to fill the combo box with image and on selecting
Retrieving data from data base using jsp combo box
Retrieving data from data base using jsp combo box Hi guys please help me , i have on GUI page int that Server type(like apache,jboss,weblogic) one... of the server it has to display the process name
from database into the process name
Store data in HTML forms from Excel sheet
Store
data in HTML forms
from Excel sheet I have a
excel file having multiple coloums, and having one Html page having forms corrospoding to
excel coloums.
I want to auto fill up the
excel data into html forms,
Any one please
Function data from web in MS excel
Function
data from web in MS excel Hello,
I would like to import
data from one webpage to
Excel using function
Data -
From Web. The problem is that this web page has at the end .jsp . When I open it via
Excel, click to
data
displaying data from ms excel in form.
displaying
data from ms
excel in form. Hi all,
I have a requirement as mentioned below:
Requirement: I have stored some
data in the ms
excel... in the column of the
excel and also the mechanism to get this
data and display
how to check dates while retrieving data from database
how to check dates while
retrieving data from database i want to update database record based on delivery date i have tried this query but it wont work
b="update deliveryorder set prtnm='"+arr[1]+"',stn='"+arr[0]+"',sbston
export data from database to excel sheet - JDBC
export
data from database to
excel sheet I am facing a problem about exporting required
data from database table to ms-
excel sheet.i mean whenever I...("
Data is saved in
excel file.");
rs.close();
connection.close();
}
catch
reading data from excel file and plotting graph
reading
data from excel file and plotting graph I am doing a project... the
data in
excel file, i have to plot graphs based on CELL ID selected. please help... that reads an
excel file using POI api and using the
data of
excel file
how to display the data from excel to webpage
how to display the
data from excel to webpage Hi,
I need help... that reads the
excel file and store
data into table.
<%@page import="java.io.*"%>... search for the value 4024 in a
excel file and to display the remaining values
How can I get specific data from JSON
How can I get
specific data from JSON Hi,
How can I get
specific data from JSON?
Thanks
Hi,
In Python you can use the json library... shows how you can get the user
from the json:
>>> import json
>>>
Read data from excel file and update database using jsp
Read
data from excel file and update database using jsp read
data from excel file and update database using jsp
Hi, I am using a MySQL database for scientific research analysis. My team members sends research
data in
excel file