Possible Duplicate:
CSV API for Java
Can you recommend a Java library for reading (and possibly writing) CSV files?
I am wondering if there is a good library that supports reading and writing csv files?
If your csv file is not big enough(to explode the memory), read it all into memory and close the file before open it in write mode. Or you should consider writing to a new file rather than the same one. Show activity on this post. It is not possible to open the same file in two different modes in python.
You can do open("data. csv", "rw") , this allows you to read and write at the same time.
Pandas is an opensource library that allows to you import CSV in Python and perform data manipulation.
I use Apache Commons CSV. http://commons.apache.org/csv/
There is also Super CSV, but I haven't tried it. http://super-csv.github.io/super-csv/
It is also not such a big deal to write something on your own IMO.
http://opencsv.sourceforge.net/
I would recommend to use opencsv
What is opencsv?
opencsv is a very simple csv (comma-separated values) parser library for Java.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With