I need to compare two worksheets with Apache POI. Is there an easy way to do this, for instance a worksheet compare function, or must I compare each cell?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Try iterating through all the cells and calculating a running hash or something like that. You run it twice, once for each worksheet and if the hash is the same – the worksheets are the same. AFAIK, there is no out-of-the-box method doing that.
I believe this is a better approach than doing a compare on a cell-to-cell basis since you’ll be having only one worksheet opened at once (as opposed to two worksheets in the cell-by-cell approach).