read data from Excel sheet

read data from Excel sheet

Hi,
 How to read data from an excel sheet   using JSP.

Thank you.
View Answers

February 26, 2011 at 5:20 PM

JSP read excel sheet

<%@page import="java.io.*"%>
<%@page import="java.util.*"%>
<%@page import="org.apache.poi.hssf.usermodel.HSSFSheet"%>
<%@page import="org.apache.poi.hssf.usermodel.HSSFWorkbook"%>
<%@page import="org.apache.poi.hssf.usermodel.HSSFRow"%>
<%@page import="org.apache.poi.hssf.usermodel.HSSFCell"%>
    <table border="1">

<%
 short a=0;
  short b=1;
  short c=2;
  short d=3;
  int i=0;
   String   value1="", value2="",value3=" ", value4="";
    String filename ="C:/hello.xls"; 
    if (filename != null && !filename.equals("")) {
    try{
    FileInputStream fs =new FileInputStream(filename);
    HSSFWorkbook wb = new HSSFWorkbook(fs);
    for (int k = 0; k < wb.getNumberOfSheets(); k++){
        int j=i+1;



    HSSFSheet sheet = wb.getSheetAt(k);
    int rows  = sheet.getPhysicalNumberOfRows();
    for (int r = 0; r < rows; r++){
    HSSFRow row   = sheet.getRow(r);
    int     cells = row.getPhysicalNumberOfCells(); 
      out.write("<br>");

    HSSFCell cell1  = row.getCell(a);

      value1 = cell1.getStringCellValue();
      HSSFCell cell2  = row.getCell(b);
        value2 = cell2.getStringCellValue();
         HSSFCell cell3  = row.getCell(c);
         value3 = cell3.getStringCellValue();
          HSSFCell cell4  = row.getCell(d);
          value4 = cell4.getStringCellValue();
    %>
    <tr><td><%=value1%></td><td><%=value2%></td><td><%=value3%></td><td><%=value4%></td></tr>
    <%
    }
        i++;
    }
    }
    catch(Exception e){
        System.out.println(e);
    }
    }
    %>
    </table>

March 22, 2011 at 12:29 PM

can you explain how to pass the "C:/hello.xls" in filename when the page is in the server









Related Tutorials/Questions & Answers:
read data from Excel sheet
read data from Excel sheet  Hi, How to read data from an excel sheet using JSP. Thank you
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
Advertisements
Read code from excel sheet and upload into database using JSP
Read code from excel sheet and upload into database using JSP  I want to upload data to database from an excel worksheet using jsp ...Please help
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
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
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 execute a query then result will be display in MS-EXCEL sheet. please give me
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
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
how to read values from excel sheet and compare with database using jsp
how to read values from excel sheet and compare with database using jsp  hi sir i am arun how to read values from excel sheet and compare... to database from excelsheet
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
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
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
How to read every cell of an excel sheet using Apache POI and insert those data into a DB?
How to read every cell of an excel sheet using Apache POI and insert those data into a DB?   i have an excel sheet, whose data in each cell has to be read and those data has to be inserted in the DB. This has to happen for all
how to display data in excel sheet?
how to display data in excel sheet?  According to the user Id,some links will be generated from the database,and if we click a link,data would... the button and to display the data in excel sheet
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
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
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
jsp with excel sheet data uploading into database
jsp with excel sheet data uploading into database  how to upload data in excel sheet with jsp into oracle 10g database
Excel sheet in read only mode - WebSevices
Excel sheet in read only mode  If am opening an excel sheet(through web application) to edit any information,Its opening in read-only mode... sheet,It has both read and write permission. How can i make the excel sheet
exporting data to excel sheet - JDBC
exporting data to excel sheet  Sir i have already send request about... = wb.createSheet("Excel Sheet"); try{ Connection con = null... = con.createStatement(); rs= st.executeQuery("Select * from data"); while(rs.next
Read a particular column in excel sheet - JSP-Servlet
Read a particular column in excel sheet  hi sir i want to a read a excel sheet ,in that i have to take a particular column that contains a mailIds ,use that column to send a mail to all so how to do this sir give me some code
Need to Remove Duplicate Records from Excel Sheet
Need to Remove Duplicate Records from Excel Sheet  Need to Remove Duplicate Records from Excel Sheet. I have one excel sheet having two fields (EmpNum, Rating) have to save in another excel sheet with unique empnum of latest
Java swing: Export excel sheet data to JTable
Java swing: Export excel sheet data to JTable In this tutorial, you will learn how to read data from excel file and export it to JTable. In swing... and POI-HSSF api. Here we are using JExcel api to fetch the data from excel sheet
How to export data from database to excel sheet by using java swing in standalone project - Java Beginners
How to export data from database to excel sheet by using java swing... database to excel sheet by using java swing in standalone project.I get solution from..., that will take the database vales from JTable to Excel sheet. import
export data to excel sheet - JSP-Servlet
export data to excel sheet  Hi.. how to export data to excel sheet from jsp? and how to update the excel sheet from jsp? and how to get the data from excel sheet? and how to make calculations in excel sheet like total avg
Reading the Date and time values from excel sheet
Reading the Date and time values from excel sheet  hi guys , iam trying to read excel sheet data using apache poi api .my problem is i cant read the date(dd/mm/yy) and time(hh:mm:ss) values concurrently from two different cells
Read a particular column in excel sheet - JSP-Servlet
Read a particular column in excel sheet  hi sir i used ur code,but where i have to put that index value ,i am calling the following methods for sending a mail please help me if any changes.Following is my code for calling methods
Export data in excel sheet in java in struts - Struts
Export data in excel sheet in java in struts  Hello, All how can i export data in excel file i java  Hi friend, For solving the problem visit to : http://www.roseindia.net/jsp/excelfile.shtml Thanks
Create Bar Graph from reading excel sheet in Java
Create Bar Graph from reading excel sheet in Java  I'm New to Java and I have to create a java program where I have to read data from multiple excel... in the different excel sheets (data can change and based on that graph should also get
Printing data into Excel sheet - Java Beginners
where there is need to bring the data into "Excel Sheet" with proper format.My... database then showing it(data) to in "Excel Sheet" is it possible to do ? if yes... a Java Bean that will retrieve the data from the database and insert it into excel
Export data to Excel Sheet in STRUTS 1.3
Export data to Excel Sheet in STRUTS 1.3  hi. how can i export content present on the jsp to excel sheet on button click..... and challenging part is i have to merge few rows and columns for a particular field(Value
excel sheet reading and using that data - JSP-Servlet
excel sheet reading and using that data  i have to do a read a excel sheet file of a employee record and then i have to use a employee details to send mail to those employees how to do in jsp sir please help me sir.. Thanks
how to read data from excel file through browse and insert into oracle database using jsp or oracle???
how to read data from excel file through browse and insert into oracle database using jsp or oracle???  sir.. i have number of excel sheets which... a browse button which can upload a excelfile and after uploading the data should
read excel file from Java - Java Beginners
read excel file from Java  How we read excel file data with the help of java?  Hi friend, For read more information on Java POI visit to : http://www.roseindia.net/java/poi/ Thanks
Convert the excel sheet data into oracle table through java or jsp
Convert the excel sheet data into oracle table through java or jsp  Hi Friends, Let me help this issue i am phasing Convert the excel sheet data into oracle table through java or jsp
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
Uploading Excel sheet record in JSP to insert data in MySql
Uploading Excel sheet record in JSP to insert data in MySql  Need Help how to upload Excel (.xls) file and insert data in Mysql using JSP it wil be wonder for me if any help me
How to save data to excel with a 2.1 work sheet format without changing it?
How to save data to excel with a 2.1 work sheet format without changing... and save it to excel file then read it again .. the problem is , when data... as ... excel 2.1 work sheet at first then read it back .. Whats the solution
Export data in excel sheet via Browse and upload button into mysql database
Export data in excel sheet via Browse and upload button into mysql database  how to create a Browse & Upload Buttons and then save the information from it in mysql database's Table Am using struts2,hibernate for making
insert rows from Excel sheet into a database by browsing the file
insert rows from Excel sheet into a database by browsing the file  hello, I am trying to insert rows from Excel sheet into SQL database by browsing Excel file in java(JSP). I can insert rows using ODBC connetion. But using odbc
update excel sheet using jsp::
update excel sheet using jsp::   Hi Sir,... I have a excel sheet for employee details "i retrieve particular datas from given excel sheet and display it into another excel sheet using jsp
php import data from excel to mysql
php import data from excel to mysql  php import data from excel to mysql
Read Excel data using JSP and update MySQL databse
Read Excel data using JSP and update MySQL databse  HOw to read excel data using JSP and update MySQl database
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 give action to that button excel sheet? how we connect excel file to java file
How to read excel data and store it in database - Java Beginners
How to read excel data and store it in database  Hi, I want a java code to read data from excel and store it in Ms Access database.I tried the code... read data into database.So please give me some sample code. Thanks
Excel sheet image reading issue
Excel sheet image reading issue   Hello every one.I?m trying to read images from an excel sheet using OleDbDataReader. My excel file has 6 columns of data, the first 5 are all text but the last is image. While I?m
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
reading excel sheet in java
reading excel sheet in java  can anyone tell me a proper java code to read excel sheet using poi   Here is a java code that reads an excel file using POI api and display the data on the console. import java.io.

Ads