Reputation: 288
So I have an excel file which looks something like this:
What I want is to be able to load the excel file with apache poi where I can filter specific cellvalues from specific columns.
for eg. I only want to get rows where for eg. the "Spuranzahl" is 2 and "Fahrbahnbreite" <34.
Right now I load the ENTIRE Excelfile using XSSF Worksheet, but is it possible to only load SPECIFIC rows. smth like an query before I load the file?
As my file is quite large it takes some time to load everyting. That is the reason I want to load specific data.
Upvotes: 1
Views: 299
Reputation: 11
you can filter while reading, although might be slower. Maybe index it in chunks with temporary index files (I haven't used apache so I don't know how apache does this).
Save the items of the first line in a map for fast lookup (header row -> for keyname and index respectively), then iterate every row, split it, and check if the index of key X matches your filter. Save that row and break or continue for other rows.
Upvotes: 1