https://github.com/takezoe/xlsbeans
Java library for mapping Excel sheets to POJO
https://github.com/takezoe/xlsbeans
excel java
Last synced: about 1 year 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 (over 12 years ago)
- Default Branch: master
- Last Pushed: 2022-06-29T16:58:10.000Z (almost 4 years ago)
- Last Synced: 2025-03-28T15:01:38.694Z (about 1 year ago)
- Topics: excel, java
- Language: Java
- Size: 236 KB
- Stars: 46
- Watchers: 9
- Forks: 17
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
XLSBeans [](https://travis-ci.org/takezoe/xlsbeans) [](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.

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)