I have programmatically created an excel sheet in which there are many rows of entries using Apache POI.
Is it possible to programmatically sort the entries in an excel sheet (alphabetically) based on the value in a certain column, by using any APIs? I need to implement this in an android app. So far I have observed that we can do this manually in the excel sheet, but is it possible to do this programmatically?
Any suggestions with regard to any .jar file (not necessarily Apache POI) will be appreciated.
Apache POI does not have a convenient way of inserting rows: basically if you insert a row you have to shift down all following rows by 1. This is computationally expensive and tedious.
I therefore usually create a list of old rows, sort the rows using a custom comparator (which would then compare your certain column) and then create a new sheet where I would write the newly sorted list of rows in the right order. Then I would delete the old sheet and rename the new one using the old sheet's name.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With