Library was done to simplify Excel files handling based on org.apache.poi
.
Both file types are supported: "Excel 97-2004 Workbook (.xls)" and "Excel Workbook (.xlsx)".
Get Easy Excel files handling library via Maven:
<dependency>
<groupId>io.github.nadjannn</groupId>
<artifactId>excelHandling</artifactId>
<version>1.2</version>
</dependency>
or Gradle:
compile group: 'io.github.nadjannn', name: 'excelHandling', version: '1.0'
- Java 8 (1.8.0_181) or higher
- Maven 3
Excel file should be opened for reading. File type will be detected based on a file extension. Provide the file name with extension, for example, someName.xls
or someName.xlsx
.
try (ExcelFile excelFile = ExcelFileFactory.openExcelFile("fileName.xlsx", HandlingType.READ)) {
// Handle excelFile. For example, read some text from first cell.
String text = excelFile.getCellValueString(0, 0);
}
io.github.nadjannn.ExcelFile
extends from java.lang.AutoCloseable
, so, explicit closing is not needed and workbook will be closed when program is finished with excel file.
See more examples in folder src/main/java/io/github/nadjannn/excel/handling/examples
.
Excel file should be opened for writing. File type is detected based on a file extension as for reading.
try (ExcelFile excelFile = ExcelFileFactory.openExcelFile("fileName.xlsx", HandlingType.WRITE)) {
// Handle excelFile. For example, write text into first cell.
excelFile.setCellValueString(0, 0, "some text");
}
See more examples in folder src/main/java/io/github/nadjannn/excel/handling/examples
.
This project is licensed under the MIT license. See the LICENSE file for more info.
Nadja Nechaeva, email: nnechae@gmail.com