This is an advanced copy of https://github.com/ozlerhakan/poiji.
Many thanks to ozlerhakan for inspiration.
Many thanks to @breucode, @aerfus, @brunslo, @wilds, @Brutus5000, @ghacupha, @itsjwala, @beckerdennis, @kpolli, @thiyagu-7, @bendh, @jrse, @abdulrafique, @virtual-machinist, @4sujittiwari, @jmorgan-iad, @fatihyildizhan, @soberich, and @chinmay1994 for contribution.
Apache POI library required as dependency to work with xlsx and xls. Tested with dependency 'org.apache.poi:poi-ooxml:5.2.5'.
In your Maven/Gradle project, first add the corresponding dependency:
<dependencies>
<dependency>
<groupId>io.github.vaa25</groupId>
<artifactId>poiji2</artifactId>
<version>1.5.0</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>5.2.5</version>
</dependency>
</dependencies>
dependencies {
implementation 'io.github.vaa25:poiji2:1.5.0'
implementation 'org.apache.poi:poi-ooxml:5.2.5'
}
Supported all features of original Poiji implemented before 2021.
Also:
-
Poiji2 is thread-safe.
-
Poiji2 reads 30% faster than Poiji (see ConcurrentTest: synchronized read for Poiji vs synchronized optimized read for Poiji2).
-
Poiji2 can write (use
Poiji.toExcel(…)
). -
Poiji2 can work with CSV (use
PoijiExcelType.CSV
, can be used without poi-ooxml dependency). -
Poiji2 can transpose sheet (use
PoijiOptions.transposed
). WARNING! Whole document loaded in memory. -
Poiji2 has mandatory column validation (use
@ExcelCellName.mandatory
). -
Poiji2 can collect parse exceptions in Entity object (use
@ExcelParseExceptions
onMap<String, ExcelParseException>
). -
Poiji2 can transform excel to Stream (use
Poiji.fromExcelToStream(…)
). WARNING! XLSX takes double time more than transform to List. -
Poiji2 has usable builders for any case (ex. use
Poiji.<JavaClass>fromExcel().withSource(new File(…)).withJavaType(JavaClass.class).toStream()
) -
Poiji2 (since v1.2.1) can be used with spring-boot-starter-web-excel
-
Poiji2 can read lists in row (use
@ExcelList
onList
) -
Poiji2 can read and write huge xlsx files (see HugeTest.java)
-
Poiji2 (since v1.4.0) can work with immutable java classes (see IgnoreTest.java). lombok @Value and java records applicable also.
-
Poiji2 (since v1.4.1) can work with immutable java classes with many constructors (see ExcelConstructorTest.java). Apply @ExcelConstructor to choose one of.
-
Poiji2 (since v1.5.0) can read sheet names (see ReadSheetNamesTest.java).