1

I am a little familiar to apache.poi, I know how to read / write in excel using Apache.poi in Java. I want to know that how can I fetch records from excel with applying some filters on a particular column or two using my script?

Here is the example what I want :

Header1 Header2 Header3
1 A 11 
2 A 13
3 A 11
4 B 12
5 B 13
6 B 12

How can I get what values are there under Header1 if I select 'A' from 'Header2' and what values are there under 'Header1' if I select '11' from 'Header3'.

Basically I just want to apply filters on 'Header2','Header3' to find what values are there under 'Header1' for the respective filter.

Please let me know the answer. Thanks.

1 Answer 1

1

I dont think there is direct method in apache poi for filters.You have to manage it in code.

-- first you have to write one method that will return list of row index(in which your value occurs)

-- one the base of row indexes,you can iterate and get the values of all other cell.

sample :

 list getRowIndexes(int filterCellValue){
// iterate over row
if(row.getcell.getcellvalue == filterCellValue){
list.add(currentrowIndex);
}

hope it may help.

}

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.