Home | Login | Blog | Forum | Download | RSS Feed | Ajax | Hello-World | J2EE | BPM | EJB | FileNet | Hibernate | ORM | IBM | ILOG | Interview | FAQs |

Java | Apache | JVM | Others | BRMS | Oracle | Pega | SOA | Sun-Certification | Web-Service | websphere | XML |
 

JAVA DEVELOPER SITE - COMPLETE JAVA TUTORIALS

Read/Write Excel Sheet using Java



 Subscribe in a reader

Newly Added TutorialNewly Added Tutorial


Share

Java Exception Handling
Thread Creation in Java
Read a File in Java
Convert List to Array
Read Excel in Java
Method Invocation Using Reflection
Ajax Basics
Stateless Session Beans Callback
Ajax Autocomplete in Java
Hello World Java
Decision Table
Object Serialization
Singleton Pattern
Java Heap Size
Set Heap Size Eclipse
OutofMemory Exception in Java
Axis Web Services
Java C++ Difference
SOA Tutorials
Filenet Platform BPM
Eclipse Tips & Tricks
enterprise service bus (ESB)
Enterprise Application Integration (EAI)
JPA Basics
ORM
Marshalling & Unmarshalling XML
JAXP Tutorial
JAXP- Read Write XML
WPS & WID
IT Jobs
IBM Websphere
Rule Engine
ILOG
ECM
JAX-WS Vs JAX-RPC
REST Web Service
Lombardi TeamWorks Vs FileNet BPM
JBoss ( JEMS)
Apache Tomcat
JMS Overview
JCA Overview
Hibernate Source Code
JPA HelloWorld
Java Beginner Tutorial
ILOG CPlex
Link/Unlink Adsense - Analytics
XSD Restriction
Convert xsd to xml / xml to xsd
ILOG Vs Drools
AJAX tutorial
Filenet tutorial
SCJP 1.6 dumps
Lombardi Tutorial
Process server
Spring
Struts Tutorial

JAVA Tutorials

Collection Framework
Operators in Java
If-else Statement

Thread
File
Generics
Input-Output in java
File Stream
Java Methods
Java Arrays
Java Objects
Java Exception Handling
Java Inheritance Tutorial
Java Threads
Garbage collection

J2EE Tutorials

Servlets Tutorials
Introduction to Struts Framework
JSP Tutorials
SPRING Framework Tutorials
STRUTS Tutorials
HIBERNATE Tutorials
Web Services Tutorials

BRMS Tutorial

ILOG
BLAZE ADVISOR
PEGA
Drools
BRMS
BPM
JRules for .NET
ilog jrules interview questions
ilog jrules certification dumps
Java Certification Study Guide
hibernate tutorial
hello world struts example

 
 
 

Useful Java Links



Reading/Writing a Excel Sheet in Java
There are two good choices for reading & writing Microsoft Excel Spreadsheet files from Java, in a platform independent way, - jexcelapi and Jakarta POI (HSSF). Both of them provide nice interface to access Excel data structure and even generate new spreadsheet. I have done extensive tests with both of them for a high-profile project for a Fortune 500 company. Previously also I had successfully used HSSF for another high profile client. In the paragraphs below I present my conclusions and sample code for reading Excel spreadsheet from Java using both the libraries. Comparison of JExcelAPI with Jakarta-POI (HSSF)
1. JExcelAPI is clearly not suitable for important data. It fails to read several files. Even when it reads it fails on cells for unknown reasons. In short JExcelAPI isnt suitable for enterprise use.
2. HSSF is the POI Projects pure Java implementation of the Excel  97(-2002) file format. It is a mature product and was able to correctly and effortlessly read excel data generated from various sources, including non-MS Excel products like Open Office, and for various versions of Excel. It is very robust and well featured. Highly recommended.
3. Performance was never a consideration in our tests because a) data integrity is the single most important factor and b) there didnt appear to be any significant performance difference while running thetests; both of them were very fast. We didnt bother to time it for the above reasons.
How to read Excel Excel Spreadsheet from Java using Jakarta POI (HSSF)
try {

POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(file)); HSSFWorkbook wb = new HSSFWorkbook(fs);

HSSFSheet sheet = wb.getSheetAt(0);

 HSSFRow row; HSSFCell cell;

int rows; // No of rows

rows = sheet.getPhysicalNumberOfRows();

int cols = 0; // No of columns

int tmp = 0;

 // This trick ensures that we get the data properly even if it doesnt start from first few rows

for(int i = 0; i < 10 || i < rows; i++)

{

row = sheet.getRow(i);

if(row != null)

 { tmp = sheet.getRow(i).getPhysicalNumberOfCells();

if(tmp > cols) cols = tmp;

} }

for(int r = 0; r < rows; r++) {

row = sheet.getRow(r);

 if(row != null) { for(int c = 0; c < cols; c++) {

cell = row.getCell((short)c);

 if(cell != null)

{ // Your code here }

} } }

 } catch(Exception ioe) { ioe.printStackTrace(); }




Download Latest Java/J2EE eBooks, SCJP Dumps, SCWCD Dumps, Pega Tutorial, IBM WebSphere BPM tutorials and many more

If you need any urgent assistance on Read_Write_Excel_Sheet_Using_Java_POI_HSSF_API, kindly email your requirement to us at : info@javagenious.com or Contact-an-Expert. Our experts will try their best to solve your problem.

You can also subscribe to our newsletters on Read_Write_Excel_Sheet_Using_Java_POI_HSSF_API, to receive updates on Read_Write_Excel_Sheet_Using_Java_POI_HSSF_API,via email.Enter you email below:

Enter your email address:

Delivered by FeedBurner



Keyword Tags: Read_Write_Excel_Sheet_Using_Java_POI_HSSF_API tutorial,Read_Write_Excel_Sheet_Using_Java_POI_HSSF_API in java,Concepts of Read_Write_Excel_Sheet_Using_Java_POI_HSSF_API,Java,J2EE,Interview Questions,Read_Write_Excel_Sheet_Using_Java_POI_HSSF_API Examples


Comments:


Post Your Comment:

*

Yes, I would like to recieve email notifications on my reply.

Related Posts on Read/Write Excel Sheet using Java

 
Popular Downloads

SCJP 1.6 Dumps
JSP Interview Questions
Struts Interview Questions
Hibernate Interview Questions
SCWCD Dumps
SCBCD Dumps

Java/J2EE Tutorial
JMS Tutorials
seam richfaces tutorial
richfaces live demo
jquery example demo
JQuery Tutorial and Source Code
JSF Tutorial
XSL Tutorial
J2EE JMS
CORBA Applications
Java CERTIFICATION
SCJP 1.5
SCJP 1.6
SCWCD 1.5
SCBCD
Mis
Ajax autosuggest autocomplete from database
Struts forms and validation with webflow
Java Apache POI Examples
JDBC Tutorial
Oracle 9i & 10g
MYSQL Tutorial
php Tutorial
JQuery Examples
Upload Java File
JAXB Examples
PL-SQL Tutorial
Dojo AJAX
EJB Examples
Java IDE
Eclipse
NetBeans
IBM Rational Weblogic Workshop
Downloads
SCJP 1.6 Dumps
SCJP 1.5 DUMP
SCJP Material
SCWCD
Java Security
SCBCD Dumps
External Links
SUN Java
JOracle
IBM
PHP Certification
Technical Interview Questions
Amazon Interview Questions
Google Interview Questions
Microsoft Interview Questions
IBM Interview Questions
Yahoo Interview Questions
All Tutorials
php mysql tutorial
SCJP 1.5/1.6
SCWCD 1.5/1.6
Polymorphism
Thread Tutorial
Generics & Exceptions
Spring Struts Hibernate
Java Collections
MAP
SET
LIST
VECTOR
Advanced Java
Stateless Session Bean
Introduction to EJB
Stateful Session Bean
Java Design Patterns
HOME | FORUM | ABOUT | BLOGS | CONTACT-US