File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How To compare two excel sheets using java

 
anilellendula kumar
Ranch Hand
Posts: 43
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 183
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 43
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8791
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
anilellendula kumar
Ranch Hand
Posts: 43
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 8791
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 20369
44
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What have you tried so far? Have you tried using Stan's pseudo code?
 
Naran Parmar
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic