Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to Retrieve the values from excel sheet properly #312

Closed
venkateshhvp opened this issue Mar 6, 2024 · 3 comments
Closed

Unable to Retrieve the values from excel sheet properly #312

venkateshhvp opened this issue Mar 6, 2024 · 3 comments

Comments

@venkateshhvp
Copy link

venkateshhvp commented Mar 6, 2024

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

Copy link

github-actions bot commented Mar 6, 2024

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

@ozlerhakan
Copy link
Owner

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]}

@venkateshhvp
Copy link
Author

venkateshhvp commented Mar 8, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants