Giter VIP home page Giter VIP logo

excelorm's Introduction

Experimental Excel ORM library

<dependency>
  <groupId>com.semihunaldi</groupId>
  <artifactId>excel-orm</artifactId>
  <version>0.0.1-BETA-SNAPSHOT</version>
</dependency>

<repositories>
  <repository>
    <id>oss.sonatype.org-snapshot</id>
    <url>http://oss.sonatype.org/content/repositories/snapshots</url>
    <releases>
      <enabled>false</enabled>
    </releases>
    <snapshots>
      <enabled>true</enabled>
    </snapshots>
  </repository>
</repositories>

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);
    }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.