hi , can anyone tell me how to read contents of a CSV file into my java string. and how to convert a CSV file to a Excel file in java .

Recommended Answers

All 3 Replies

Member Avatar

hi , can anyone tell me how to read contents of a CSV file into my java string. and how to convert a CSV file to a Excel file in java .

To read in a csv file, would be just the same as reading in a normal text file.

You would just use the split() method to separate your lines by the commas.

Converting a CSV to excel would be more difficult. However, there should be some third party programs you can use to do that bundled up as a jar file. In fact I've used one successfully before.

or you can write your own, outputting SLK for example.
The format is well described and though messy offers flexibility.

Technically of course you wouldn't have to do anything as Excel can read and interpret CSV files directly ;)

Member Avatar

Technically of course you wouldn't have to do anything as Excel can read and interpret CSV files directly

Oopsie. I didn't even think of that.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.