Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/takezoe/xlsbeans
Java library for mapping Excel sheets to POJO
https://github.com/takezoe/xlsbeans
excel java
Last synced: 2 days ago
JSON representation
Java library for mapping Excel sheets to POJO
- Host: GitHub
- URL: https://github.com/takezoe/xlsbeans
- Owner: takezoe
- License: apache-2.0
- Created: 2013-12-30T06:30:41.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2022-06-29T16:58:10.000Z (over 2 years ago)
- Last Synced: 2024-04-16T11:18:12.548Z (6 months ago)
- Topics: excel, java
- Language: Java
- Size: 236 KB
- Stars: 46
- Watchers: 10
- Forks: 17
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
XLSBeans [![Build Status](https://travis-ci.org/takezoe/xlsbeans.svg?branch=master)](https://travis-ci.org/takezoe/xlsbeans) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.github.takezoe/xlsbeans/badge.svg)](https://maven-badges.herokuapp.com/maven-central/com.github.takezoe/xlsbeans)
========XLSBeans is a Java library for mapping Excel sheets to POJO.
## Setup
To use XLSBeans, add the following dependency to your pom.xml:
```xml
com.github.takezoe
xlsbeans
1.2.7
```
## Getting Started
For example, here is one Excel sheet.
![Sample Excel](excel.png)
Map this Excel sheet to POJO using ```@HorizontalRecords``` and ```@LabelledCell```.
```java
@Sheet(name="Users")
public class UserList {@LabelledCell(label="Title", type=LabelledCellType.Right)
public String title;@HorizontalRecords(tableLabel="User list", recordClass=User.class)
public List users;}
```And the following is the record class. Properties of the record class is mapped to columns by ```@Column```.
```java
public class User {@Column(columnName="ID")
public int id;@Column(columnName="Name")
public String name;@Column(columnName="Gender", merged=true)
public String gender;}
```You can get the mapped POJO using ```XLSBeans#load()``` like following:
```java
UserList userList = (UserList)new XLSBeans().load(
new FileInputStream("example.xls"), UserList.class);
```## Documentation
See more details in http://amateras.sourceforge.jp/site/xlsbeans/howtouse.html (in Japanese)