Excel (XLS)

XlsDataSet reads and writes MS Excel dataset documents. Each sheet represents a table. The first row of a sheet defines the column names, and the remaining rows contain the data.

IDataSet dataSet = new XlsDataSet(new File("dataset.xls"));

An empty or absent cell is read as a null value. Because every column is declared in the header row, a later row with a blank cell keeps the column — Excel has no "extra columns" problem. For how a cell value becomes a typed column value — binary/BLOB syntax, literal and relative dates, UUID literals, and booleans/numbers from strings (in text cells) — see Dataset Values.

Dependency

dbUnit depends on Apache POI to read/write Excel files, but marks it optional so projects that don’t use XlsDataSet don’t pull it in. Add it yourself to use this format:

<dependency>
  <groupId>org.apache.poi</groupId>
  <artifactId>poi</artifactId>
  <version>5.2.5</version>
</dependency>