Win a copy of Microservices Testing (Live Project) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

How To compare two excel sheets using java

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 22662
127
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What have you tried so far? Have you tried using Stan's pseudo code?
 
Naran Parmar
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
reply
    Bookmark Topic Watch Topic
  • New Topic