CSV/Excel Utility Package for Java
Table of Contents
- What is the CSV/Excel Utility Package?
- Maven Coordinates
- How to report a Bug or request a Change
What is the CSV/Excel Utility Package?
Unfortunately, Java does not offer any methods to simply read CSV files or produce such, not mentioning Excel. I for myself found it quite easy to work with such files; especially when you need to deal with data from and to Microsoft Excel.
My CSV/Excel Utility Package, published under the GNU Lesser General Public License, allows you to easily integrate CSV and Excel functionality into your application, just by using Iterator-like classes for reading, and PrintStream-like classes for writing. The CSV tools can be configured to use different column delimiter and separator characters in case you need to adopt some other versions of CSV. The default configuration conforms to the Excel style of CSV.
The Excel tools conform to the same way that CSV tools behave (see below). Therefore, two new interfaces TableReader and TableWriter were introduced to reflect the common functions. The new ExcelWriter allows you to easily create Excel files while still having the flexibility of formatting issues (see ExcelFormatter interface). The implementation is based on Apache’s POI library.
Since this CSV/Excel package uses streams, you are able to read from any stream. And, of course, you can write to any stream. You could even synchronize within your application by applying the reader/writer synchronization described in one of my articles.
Please notice that some methods are deprecated since V2.0 and CSVReader and CSVWriter classes are moved into other packages in favour of readability and structuring of the classes.
<dependency> <groupid>eu.ralph-schuster</groupid> <artifactid>csv</artifactid> <version>2.6.1</version> </dependency>
The most recent stable version is V2.6.1. You can download it here. It includes the source files, the API documentation and the ready-to-use binary JAR file. You could also browse the Subversion repository and the API documentation. There is also a FAQ available which explains most common tasks by examples.
Nightly builds have been abandoned since Maven migration. You can find the latest Snapshot at Sonatype’s repository.
You can download earlier releases and browse the API documentation, too:
- V2.6.0: Download – API Documentation
- V2.5.0: Download – API Documentation
- V2.4.0: Download – API Documentation
- V2.3: Download – API Documentation
- V2.2: Download – API Documentation
- V2.1: Download – API Documentation
- V2.0.2: Download – API Documentation
- V2.0.1: Download – API Documentation
- V2.0.: Download – API Documentation
- V1.0.1: Download – API Documentation
- V1.0.2: Download – API Documentation
- V1.0: Download – API Documentation
How to report a Bug or request a Change
There is a JIRA instance running at http://jira.ralph-schuster.eu/ where you can report bugs or request changes. Contributions are also welcome via JIRA.
Many thanks to the following people for improving CSV/Excel Utility Package:
- eldn – JUnit Testing
- Andrej Czapszys – Handling of blank lines and calculated cells in Excel