ozlerhakan / poiji

:candy: A library converting XLS and XLSX files to a list of Java objects based on Apache POI

Home Page:https://ozlerhakan.github.io/poiji/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to Retrieve the values from excel sheet properly

venkateshhvp opened this issue · comments

Hi @ozlerhakan ,

I implemented the same way as you mentioned in the documentation, but I m not able to get the values properly.
Instead of the excel values, I m getting only the instance like this [ExcelPoijiDemo@71ae31b0, ExcelPoijiDemo@4ba534b0]

Main.java
List demo = Poiji.fromExcel(new File("inputdata.xlsx"), ExcelPoijiDemo.class);
System.out.println(demo);

ExcelPoijiDemo.java
@excelsheet("Sheet1")
public class ExcelPoijiDemo {

@ExcelCellName("name")
private String name;

@ExcelCellName("department")
private String department;

}

POM.xml
image

image

Thank you for contributing to Poiji! Feel free to create a PR If you want to contribute directly :)

Hi @venkateshhvp ,

This is the way how we can retrieve rows from an excel file:

PoijiOptions options = PoijiOptions.PoijiOptionsBuilder.settings()
        .addListDelimiter(";") (1)
        .build();
List<Employee> employees = Poiji.fromExcel(new File("employees.xls"), Employee.class, options);
// alternatively
InputStream stream = new FileInputStream(new File("employees.xls"))
List<Employee> employees = Poiji.fromExcel(stream, PoijiExcelType.XLS, Employee.class, options);

employees.size();
// 3
Employee firstEmployee = employees.get(0);
// Employee{rowIndex=1, employeeId=123923, name='Joe', surname='Doe', age=30, single=true, emails=[joe@doe.com, joedoe@gmail.com], biils=[123,10, 99.99]}

Hi @ozlerhakan,my output is different than what you showed. Please check and confirm if anything is wrong from my side.

PROJECT STRUCTURE
image

MAIN FILE
image

POJO FILE
image

OUTPUT
image

INPUT EXCEL
image

I tried giving (1) as attached, but not sure what it was meaning and got syntax error.
image