can any one suggest me to convert my xlsx sheet to java object using Apache POI.
eq, my excel sheet contains two columns
Check the below repo. It was developed by keeping "ease of use" in head. https://github.com/millij/poi-object-mapper
Initial version has been published to Maven Central.
io.github.millij
poi-object-mapper
1.0.0
Works similar to Jackson. Annotate your bean like below..
@Sheet
public class Employee {
// Pick either field or its accessor methods to apply the Column mapping.
...
@SheetColumn("Age")
private Integer age;
...
@SheetColumn("Name")
public String getName() {
return name;
}
...
}
And to read..
...
final File xlsxFile = new File("");
final XlsReader reader = new XlsReader();
List employees = reader.read(Employee.class, xlsxFile);
...
As it stands, all primitive data types are supported. Still working on adding support for Date, Formula etc..
Hope this helps.