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 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









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 of value from excel file - JSP-Servlet
retrieving of value from excel file  Dear sir, Thanks for sending... this message to all the employees when i upload a file then it fetch a data from that excel sheet i.e this matter will take a para meter values from the excel
Advertisements
retrieving of value from excel file - JSP-Servlet
retrieving of value from excel file  Dear sir, Thanks for sending... this message to all the employees when i upload a file then it fetch a data from that excel sheet i.e this matter will take a para meter values from the excel
retrieving of value from excel file - JSP-Servlet
retrieving of value from excel file  Dear sir, Thanks for sending a code now i am getting a particular column value i.e EmailId column... to all the employees that are in the excel sheet.So in the previous code i have got
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
read data from Excel sheet
read data from Excel sheet  Hi, How to read data from an excel sheet using JSP. Thank you
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
php import data from excel to mysql
php import data from excel to mysql  php import data from excel to mysql
extract data from excel sheet to mysql
extract data from excel sheet to mysql  sir, i want to extract data from excel sheet and save the data in mysql5.0 database in the form of table
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
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
read excel data from jsp - JSP-Servlet
read excel data from jsp  Hi how to read excel file from jsp? Excel file is created manually entered data having many sheets? and read the entire...)excel.jsp: Read And Edit Excel File  continue
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
How to get data from Excel sheet - Struts
How to get data from Excel sheet  Hi, I have an excel sheet with some data(including characters and numbers). Now i want read the data from excel sheet and display in console first then later insert this data into database
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
Read data from Excel and insert in to DB and export data from DB to Excel
Read data from Excel and insert in to DB and export data from DB to Excel  Read data from Excel and insert in to DB and export data from DB to Excel Hi, I need to read the data from excel and I need to insert the same in to DB
Read specific column data from text file in java
Read specific column data from text file in java  My question is if my text file contain 15 columns and i want read specific column data from that text file then what code i should do
retrieving of data from one jsp to another jsp - JSP-Servlet
retrieving of data from one jsp to another jsp  using jsp i m displaying a table ,in table i m displaying a radio button then values like id,name etc ,if i click on an radio button i have to get a corresponding id value
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
The code for retrieving data from database into Drop Down List.
The code for retrieving data from database into Drop Down List.  <% DataSource data = new MysqlDataSource(); Connection con... to MySQL"); PreparedStatement pre = con.prepareStatement("select * from
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 to export data from jsp to excel sheet by using java
How to export data from jsp to excel sheet by using java   How to export data from jsp to excel sheet by using java
How to export data from html to excel sheet by using java
How to export data from html to excel sheet by using java   How to export data from html to excel sheet by using java
retrieving data from database to the textbox depending upon the id in jsp
retrieving data from database to the textbox depending upon the id in jsp  Hi, our project involves fetching of data from database into textbox... data =""; try{ Class.forName("com.mysql.jdbc.Driver
How to extract the entire line with specific data from a Text in java?
How to extract the entire line with specific data from a Text in java?  Hi, i would like to extract data from text like the following one: [CODE... my prog? i know how to read specific line from text with the lineNumber
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 >>>
retrieving data in to the dropdown box from postgresql database in core java
retrieving data in to the dropdown box from postgresql database in core...=st.executeQuery("SELECT role_name from role WHERE dept_id=1234"); if(rs...=con.createStatement(); ResultSet rs=st.executeQuery("select * from student
How to export data from html file to excel sheet by using java
How to export data from html file to excel sheet by using java    How to export data from html file to excel sheet by using java
How to Get The Data from Excel sheet into out jsp page???
How to Get The Data from Excel sheet into out jsp page???  How to Get The Data from excel sheet to out jsp page in webApp
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
How to export data from html file to excel sheet by using java
How to export data from html file to excel sheet by using java   reading the data from Html file
How to Retrieve Data from the database and write into excel file using Java
How to Retrieve Data from the database and write into excel file using Java  Hi, I am trying to develop an small application where i trying to retrieve Data from the database and store the details in excel file. Please can
connection of java file to excel file and put data from excel file into oracle db
connection of java file to excel file and put data from excel file into oracle db  how to create button on excel sheet using java swing and how we... as wellas to oracle db to insert excel data into database
how to make a radiobutton selected when retrieving data from database using struts framework and spring jdbc
how to make a radiobutton selected when retrieving data from database using struts framework and spring jdbc  how to make a radio button selected when retrieving data from database using struts framework and spring jdbc
How to import data from sql server table into an excel file by creating the rows dynamically in the excel according to the dataabase??
How to import data from sql server table into an excel file by creating the rows dynamically in the excel according to the dataabase??  How to import data from sql server table into an excel file by creating the rows dynamically
How to draw to graph in Ms Excel from the data which is sent from an java application....?
How to draw to graph in Ms Excel from the data which is sent from an java application....?  How to draw to graph in Ms Excel from the data which is sent from an java application
Retrieve Data from the database and write into excel file
Retrieve Data from the database and write into excel file. In this section, we are going to retrieve data from the database and write into the excel file...); fileOut.close(); System.out.println("Data is saved in excel file
retrieving query data
retrieving query data   Blockquote I am new to java or hibernate... Trying to get data from database...it does not pick up the data... domainName from User"); List <String> domains = query.list
Wrong parameter values while exporting data from jsp to excel
Wrong parameter values while exporting data from jsp to excel   This is a jsp report. When i export the report data to an excel, the parameter...(); out.println("Data is saved in excel file."); }catch ( Exception ex ){ } %>
Retrieving JTree structure from database
Retrieving JTree structure from database       This example shows how to retrieving data from... the data from the table. This data can be used to populate the data for the node
How to export data from database to excel sheet by using java in standalone project
How to export data from database to excel sheet by using java in standalone project  How to export data from database to excel sheet by using java in standalone project
Hi how to transfer table data from html page to excel sheet by using javascript .
Hi how to transfer table data from html page to excel sheet by using javascript .  html page to excel sheet by using javascript and i dont want to transfer all rows in table, i want to hide some rows in excel sheet. Please send
Export html data to excel
Export html data to excel  I am trying to export data from an html page to an excel sheet.Any advise
retrieving xml document from database
retrieving xml document from database  Hi Guys, I want to retrieve the xml document stored in the database on to a jsp page using jdbc/odbc connnection.Please help me in implementing this feature. Thank You Madhu
retrieving from db - JSP-Servlet
retrieving from db  hello' I am trying to write my first application...; Hi Retrive value from database Retrive data from...: rst=stmt.executeQuery("select * from books_details"); 27: %> 28
Insert data in Excel File from Database using JSP
Insert data in Excel File from Database  using JSP ... will retrieve the data from database, create an excel file and data insert... developed a application to insert data  in excel file from database in JSP. We
Retrieving Data from the table using PreparedStatement
Retrieving Data from the table using PreparedStatement... to fetch the data from the database in the table from our java program using... the getWriter() method of the PrintWriter class. We can retrieve the data from

Ads