Using Commons CSV

Commons CSV reads and writes files in variations of the Comma Separated Value (CSV) format.

To parse an Excel CSV file, write:

Reader in = ...;
Iterable<CSVRecord> parser = CSVFormat.EXCEL.parse(in);
for (CSVRecord record : parser) {
    ...
}

Other formats are available, please consult the Javadoc for CSVFormat and CSVParser

Getting the code

There are currently no official downloads, and will not be until version 1.0 is released, but nightly builds may be available from http://people.apache.org/builds/commons/nightly/commons-csv/.

The latest code can be checked out from our Subversion repository at http://svn.apache.org/repos/asf/commons/proper/csv/trunk/.

You can build the component using Apache Maven 3. For example: mvn clean site. Maven 2 will not work.

Reporting bugs

Please report any bugs or issues in the Commons Sandbox Jira project at http://issues.apache.org/jira/browse/CSV. Please ask any questions or suggest any ideas for improvement on the commons-dev and commons-user mailing lists.

About Commons CSV

Commons CSV was started to unify a common and simple interface for reading and writing CSV files under an ASL license. It has been bootstrapped by a code donation from Netcetera in Switzerland. There are three pre-existing BSD compatible CSV parsers which this component will hopefully make redundant (authors willing):

In addition to the code from Netcetera (org.apache.commons.csv), Martin van den Bemt has added an additional writer API.

Other CSV implementations: