Create Excel CSV files with ease

Now I know that creating a comma separated file is no big deal, and is quite trivial. I am sure that everyone, at one time or another, has written a program where they either had to read and/or write a CSV file. I know that I have had to do this on numerous occasions. I use to add quotations and comma’s in my data to delineate the different fields. As this does work, I never took the time to create a set of utilities in a jar file that I could import into any of my projects and easy call and use.

Well instead of creating my own code utility I did a little searching on the internet. Low and behold I found the Ostermiller Java Utilities which provides everything that I ever wanted in writing and reading CSV files. Not only does the author provide you with a easy and reusable way of working with CSV file, he has incorporated a bunch of other utilities for you as well. I have found that his Java CSV utilities to be very easy to use and are well documented with nice examples. I like the way that the author has incorporated different calls for created not only regular CSV files but has incorporated all the rules necessary for creating Excel CSV formats. Using this tool, I have never had a issue with another application reading my CSV output.

His tool does not only assist you while working with CSV files, but he has also created many other useful utility that can just simply save you time. Here is a list from his site what the utility provides.


* ArrayHelper – Helpful utilities for working with arrays.
* Base64 – Encode and decode base 64.
* Browser – Open a browser from an application on Windows, Unix, or Macintosh.
* CGI Query String Parser – Libraries to to parse the query data supplied by HTTP GET or POST requests.
* Circular Buffers – Implements the circular buffer producer/consumer model for bytes.
* Command Line Parser – Handle options and arguments to Java command line programs.
* Concatenation Streams – Combine multiple streams of incoming data to create a single stream.
* Comma Separated Values (CSV) - Libraries to read and write files in Comma Separated Value (CSV) format. (Excel CSV Format also available)
* Exec Helper – Convenience methods for executing external applications that output data.
* File Helper – Methods for manipulating files.
* Iterators and Enumerations – Convert between Iterators and Enumerations or convert arrays to Iterators or Enumerations.
* Line Ends – Converts text files between various system formats.
* MD5 Sums – Classes for generating MD5 checksums on String, Byte arrays, Streams, or Files.
* NoClose Streams – Create streams that cannot be closed with the regular close() mechanism.
* Parallelizer – Runs multiple jobs in parallel, n threads at a time, and waits until all threads are complete before continuing.
* Password Dialog – A password dialog box written for Swing.
* Random Password Generator – Generate a random String using a cryptographically secure random number generator.
* Significant Figures – Handles parsing, rounding, and displaying numbers for scientific applications.
* Size Limit Input Stream – Create a substream of a specified length from an existing input stream.
* String Helper – Methods for formatting, manipulating, and querying Strings.
* String Tokenizer – A StringTokenizer replacement with enhancements.
* Straight Stream Reader – An input stream reader that does no character class translation.
* Tabs – Tab adjuster that can convert tabs to spaces and vice versa.
* Uber Properties – A replacement for the java.utils.Properties class with enhancements.

Posted on Aug 13, 2008 by Mike Jennings in Java | 3 Comments | Permalink



Comments:

Try Groovy... it is dead easy to communicate with Excel...and it is java

Posted by andhapp on August 15, 2008 at 12:54 PM EDT #

Thanks for the information. I have been meaning to check Groovy out for a while. Now I have one good reason to go and do it.

Posted by Mike Jennings on August 15, 2008 at 03:50 PM EDT #

Yes, Ostermillers' are just great, but they use GPL license: You can use them for free, if (and only if) your own code is free as well. If your code is not free, you must not use the Ostermiller Java Utilites.

Posted by Reiner Saddey on October 29, 2008 at 12:19 PM EDT #

Post a Comment:
  • HTML Syntax: Allowed