Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / April 2005

Tip: Looking for answers? Try searching our database.

request for CSV converter program

Thread view: 
Jeffrey - 16 Apr 2005 17:17 GMT
I guess some of you might have written some utility programs that allow
you to convert a CSV file to another CSV file with fewer columns and
having some field values mapped according to some rules.

I am looking for a similar solution to help my poor colleague to
simplify his daily manual work to reformat several CSV files using
excel.
Rhino - 16 Apr 2005 18:05 GMT
> I guess some of you might have written some utility programs that allow
> you to convert a CSV file to another CSV file with fewer columns and
[quoted text clipped - 3 lines]
> simplify his daily manual work to reformat several CSV files using
> excel.

First, I'm not really sure what you mean by converting a CSV file to another
that has fewer columns and has some field values mapped according to some
rules. It's a very vague description of what you want and I don't get a
clear picture of what you mean. A simple example of what you mean would be
useful.

Second, I don't see anything in the description of the problem that
especially lends itself to Java, as opposed to the umpteen other programming
languages out there. In fact, it sounds like more of a batch utility to me
than a Java program. If I were going to write something like that, I might
be more inclined to use a BASH script or REXX or one of the Linux utilities.
There are many script-type languages out there that do a very good job with
this kind of task and carry a lot less overhead than Java.

You might get a better answer on the newsgroups associated with those
languages.

Rhino
Betty - 16 Apr 2005 18:46 GMT
> I guess some of you might have written some utility programs that allow
> you to convert a CSV file to another CSV file with fewer columns and
[quoted text clipped - 3 lines]
> simplify his daily manual work to reformat several CSV files using
> excel.

It is probably easier in Perl or Python, but if you want to
use Java you can read the file a line at a time using something like
 while ((line = in.readLine()) != null)
then split the string into smaller strings
 String columns[]   = line.split(",");
 // your magic goes here
then output the columns you want
 out.print(columns[0]+","+columns[1]+"," .....
 out.println();
Robert - 17 Apr 2005 04:11 GMT
Check out the Ostermiller java utilities.  He has a CSV parser or
printer or something and a special excel compatible one as well, I
think.

http://ostermiller.org/utils/


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.