GeeCON Prague 2014*
The moose likes Java in General and the fly likes How To compare two excel sheets using java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "How To compare two excel sheets using java" Watch "How To compare two excel sheets using java" New topic
Author

How To compare two excel sheets using java

anilellendula kumar
Ranch Hand

Joined: Jul 12, 2005
Posts: 43
Hi All,


How To comapre two Excel sheets using java and difference of two excel sheets should write in log file where the difference in the two file


i.e log file contains the difference of two excel , want which API supports these comparison and wat is the process to compare
Rajagopal Manohar
Ranch Hand

Joined: Nov 26, 2004
Posts: 183
You could check out the POI API from jakarta http://jakarta.apache.org/poi/
It helps you acess Excel

In case it is a simple format consider using JDBC-ODBC bridge and acess the excel sheet as though you are acessing DB's and comparing tables using JDBC API.
anilellendula kumar
Ranch Hand

Joined: Jul 12, 2005
Posts: 43
hi,

i have used Jexcel API to write and read excel sheet , i want to comapre two excel sheets and writing the difference in log files

jexcel API we can write and read the excel sheets
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
Sounds like you're stuck on how to compare. What kinds of differences are you looking for?

Sheet 1 has a row that sheet 2 does not?
Sheet 2 has a column that sheet 2 does not?
Sheet 1 has more cells in a named range?
Sheet 1 has a different value in one cell?
Different formulae? Values? Colors? Column width?

Ok, I got a bit silly there, but can you narrow it down some?


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
anilellendula kumar
Ranch Hand

Joined: Jul 12, 2005
Posts: 43
No, i want To compare the Two Excel Files with difference of columns and row data

suppose one excel file 1st row and 1st column value is "Anil"


in Second Excel file ist row nad ist column value is "Anil Kumar"


then in Log file should have the where the differenece in the two files i.e

first file 1st row-1st column --Anil
Second file 1st row -1st column ---Anil Kumar Vice versa
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
I have no idea what kind of data structures you have after you read from Excel, but the basic compare might be as simple as:

I asked about finding missing or extra rows because comparing two sorted lists has a different technique.

Note you might have to mix these - when you find matching keys in a sorted list then compare all the columns.
Naran Parmar
Greenhorn

Joined: Apr 04, 2009
Posts: 6
Did anyone get the answer for

How To comapre two Excel sheets using java and difference of two excel sheets should write in log file where the difference in the two file

Thanks in Advance.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19697
    
  20

What have you tried so far? Have you tried using Stan's pseudo code?


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Naran Parmar
Greenhorn

Joined: Apr 04, 2009
Posts: 6
Hi,
Rob Prime

As of now I am doing the xls comparison throug field by field. I mean to say From xls A I will pick the firest Row & from xls B i will pick one row. After getting the data I will do field by field comparison.

So currently I am following that way.
I just wanted to ask Is there any alternative solution for the same?
 
Don't get me started about those stupid light bulbs.
 
subject: How To compare two excel sheets using java