Skip to content

Serbroda/poi-data-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

POI data template

Build Status jitpack

Installation

Add the jitpack repository.

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>

Add the dependency (for all available versions see https://jitpack.io/#Serbroda/poi-data-template).

<dependency>
    <groupId>com.github.Serbroda</groupId>
    <artifactId>poi-data-template</artifactId>
    <version>VERSION</version>
</dependency>

Usage

test.xlsx

+----+------------+------------+------------+---------+
| ID | FIRST_NAME | LAST_NAME  |    DATE    |  SALES  |
+----+------------+------------+------------+---------+
|  1 | Max        | Mustermann | 01.02.2018 | 12,95 € |
|  2 | John       | Doe        | 27.06.2018 | 29,50 € |
+----+------------+------------+------------+---------+

 public static class Data {
    public int id;
    public String firstName;
    public String lastName;
    public Date date;
    public BigDecimal sales;
}

private ExcelSource source = new ExcelFileSource("test.xlsx");

List<Data> data = new ExcelDataTemplate()
    .read(source, 0, row -> {
        Data d = new Data();
        d.id = (int) row.getCell(0).getNumericCellValue();
        d.firstName = row.getCell(1).getStringCellValue();
        d.lastName = row.getCell(2).getStringCellValue();
        d.date = row.getCell(3).getDateCellValue();
        d.sales = new BigDecimal(row.getCell(4).getNumericCellValue());
        return d;
    }, true);

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages