Experimental Excel ORM library
- Every sheet maps to only ONE POJO.
- Sadly, every time you need to update any data, whole sheet of the excel will be rewritten. This will be a major problem if data is huge.
- Only String, Integer, Double, BigInteger, Long, Boolean and Date classes are supported.
Name | Last Name | Age | Amount | Description | Date |
---|---|---|---|---|---|
Name1 | Last Name1 | 11 | 101.1 | description1 | 16/09/2017 19:30 |
Name2 | Last Name2 | 12 | 102.2 | description2 | 16/09/2017 19:30 |
Name3 | Last Name3 | 13 | 103.3 | description3 | 16/09/2017 19:30 |
Name4 | Last Name4 | 14 | 104.4 | description4 | 16/09/2017 19:30 |
@Excel(firstRow = 1, firstCol = 0, sheetName = "Tasks")
@Data
public class Task extends BaseExcel
{
@ExcelColumn(col = 0 , columnName = "Name")
private String firstName;
@ExcelColumn(col = 1 , columnName = "Last Name")
private String lastName;
@ExcelColumn(col = 2 , columnName = "Age")
private Integer age;
@ExcelColumn(col = 3 , columnName = "Amount")
private Double amount;
@ExcelColumn(col = 4 , columnName = "Description")
private String description;
@ExcelColumn(col = 5, columnName = "Date", dateFormat = "dd/MM/yyyy HH:mm")
private Date date;
}
public class Test
{
public static void main(String[] args)
{
ExcelReader excelReader = new ExcelReader();
List<Task> taskList = excelReader.read(new File("/some/path/Excel.xlsx"), Task.class);
//
ExcelWriter excelWriter = new ExcelWriter();
excelWriter.write(new File("/some/path/Excel_new.xlsx"),taskList,Task.class);
}
}