Skip to content

About

Annotation-driven Excel (.xlsx) generation from Java POJOs and records, built on Apache POI, with Spring Boot auto-configuration.

Topics

Resources

Stars

3 stars

Watchers

1 watching

Forks

Repository files navigation

sheetsmith

sheetsmith: an annotated Java record turned into a styled Excel sheet

JDK 17 JDK 21 JDK 25 Maven Central License

Annotation-driven Excel (.xlsx) generation from Java POJOs and records, built on Apache POI, with Spring Boot auto-configuration.

Documentation: sheetsmith.baldilorenzo.cloud

Describe a table once with annotations, pass a list of objects, get an .xlsx file as a byte[] or written to an OutputStream: title, header, rows, styles, presets and formats included.

Quick start

Add the starter with Maven:

<dependency>
    <groupId>cloud.baldilorenzo.sheetsmith</groupId>
    <artifactId>sheetsmith-spring-boot-starter</artifactId>
    <version>1.0.0</version>
</dependency>

or with Gradle:

implementation("cloud.baldilorenzo.sheetsmith:sheetsmith-spring-boot-starter:1.0.0")

Describe the sheet:

@ExcelSheet(title = "Customers", preset = TablePreset.MEDIUM, accentColor = "#1F4E79")
public record CustomerRow(
        @ExcelColumn(header = "Name", order = 10) String name,
        @ExcelColumn(header = "Customer since", order = 20, format = "dd/mm/yyyy") LocalDate since,
        @ExcelColumn(header = "Revenue", order = 30, format = "#,##0.00") BigDecimal revenue) {
}

Generate the file with the auto-configured bean:

byte[] file = sheetsmith.generate(List.of(SheetData.of("Customers", CustomerRow.class, customers)));

Without Spring, depend on sheetsmith-core and create the generator with Sheetsmith.builder().build().

Modules

Module Purpose
sheetsmith-core Framework-agnostic core: annotations, metadata extraction, style resolution, workbook writing
sheetsmith-spring-boot-autoconfigure Spring Boot auto-configuration
sheetsmith-spring-boot-starter The only dependency Spring Boot applications need to declare

Requirements

  • Java 17 or later (built and tested on Java 17, 21 and 25)
  • Spring Boot 4, for the Spring Boot integration only

Building

./mvnw verify

License

Licensed under the Apache License, Version 2.0.

About

Annotation-driven Excel (.xlsx) generation from Java POJOs and records, built on Apache POI, with Spring Boot auto-configuration.

Topics

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages