Experimental Excel ORM library
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
.gitignore
LICENSE
README.md
pom.xml

README.md

Experimental Excel ORM library

Limitations

  • 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, Date and Enum classes are supported.

Name Last Name Age Amount Description Date Status
Name1 Last Name1 11 101.1 description1 16/09/2017 19:30 FINISHED
Name2 Last Name2 12 102.2 description2 16/09/2017 19:30 ACTIVE
Name3 Last Name3 13 103.3 description3 16/09/2017 19:30 ACTIVE
Name4 Last Name4 14 104.4 description4 16/09/2017 19:30 FINISHED
@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;
    
    @ExcelColumn(col = 6, columnName = "Status")
    private Status status;
}
public class Test
{
    public static void main(String[] args)
    {
        File file = new File("/some/path/Excel.xlsx");
        //reading
        ExcelReader excelReader = new ExcelReader();
        List<Task> taskList = excelReader.read(file, Task.class);
        //writing
        ExcelWriter excelWriter = new ExcelWriter();
        taskList.remove(2);
        excelWriter.write(file,taskList,Task.class);
    }
}