aspose file tools
The moose likes Java in General and the fly likes creating and parsing csv files Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "creating and parsing csv files" Watch "creating and parsing csv files" New topic
Author

creating and parsing csv files

m winzenburg
Greenhorn

Joined: Jul 17, 2002
Posts: 8
Has anyone written any code to create or parse CSV files? I saw a post awhile back about some freeware, but I'm not sure
I can use that for commercial purposes. (Also, some of the source code was omitted, and unfortunately the classes I needed didn't compile.)
From what I've read, Java's StringTokenizer and StreamTokenizer are not really designed to deal with comma-separated flat files.
Yes, I can write it myself, but I thought why reinvent the wheel if there is code out there, especially for something as common as handling csv files.
James Carman
Ranch Hand

Joined: Feb 20, 2001
Posts: 580
The main problem with using StringTokenizer with CSV files is that the StringTokenizer eats all the tokens that occur next to one another. So, if there are two commas in a row, it basically skips a column.


James Carman, President<br />Carman Consulting, Inc.
Sayed Ibrahim Hashimi
Ranch Hand

Joined: May 17, 2001
Posts: 148
Why don't you use Regular Expressions I'm sure it would make your life a lot easier if you do have to implement it.


SCJP 1.4<br /><a href="http://www.cise.ufl.edu/~sih" target="_blank" rel="nofollow">www.cise.ufl.edu/~sih</a>
Yoo-Jin Lee
Ranch Hand

Joined: Nov 01, 2000
Posts: 119
You can also use a jdbc driver for csv files. There are many free ones out there.

-Yoo-Jin
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: creating and parsing csv files
 
Similar Threads
Column Name for .csv File
batch file script problem
Serving Excel Content
generic parser
Opening Excel file from within Java program