Questions tagged [supercsv]

Super CSV is a fast and free open-source CSV API for Java.

Super CSV is a fast and free open-source CSV API for Java, written by Kasper Graversen.

The developers of Super CSV follow this tag, so you can receive expert advice on your Super CSV problems by using this tag.

Before asking a question, check the documentation and examples on the project website.

Please note that you can also receive help at the project's GitHub site, as well as report any issues you have encountered.

Related Links:

202 questions
38
votes
8 answers

Unwanted double quotes in generated CSV file

I have created a CSV file using the Java code below: String csv = rs.getString("UPLOAD_FOLDER_PATH")+".csv"; CSVWriter writer = new CSVWriter(new FileWriter(csv)); String [] filevalues = new…
Edward
  • 1,367
  • 8
  • 26
  • 43
30
votes
10 answers

OpenCSV - How to map selected columns to Java Bean regardless of order?

I have a CSV file with the following columns: id, fname, telephone, lname, address. I have a Person class with id, fname and lname data members. I want to map only these columns to Person object from a CSV file and discard telephone and address…
jsf
  • 2,851
  • 9
  • 30
  • 33
12
votes
6 answers

Java - Write hashmap to a csv file

I have a hashmap with a String key and String value. It contains a large number of keys and their respective values. For example: key | value abc | aabbcc def | ddeeff I would like to write this hashmap to a csv file such that my csv file contains…
activelearner
  • 7,055
  • 20
  • 53
  • 94
12
votes
2 answers

Creating multiple sheets in CSV file

I am using superCSV to write data in csv format in my code. Its working absolutely fine and very efficiently , but now my requirement changed . I need to write multiple sheets in single xls file which is very time consuming task. So is there is any…
user3363969
  • 233
  • 1
  • 4
  • 15
11
votes
5 answers

Complex Java object to CSV

I'm trying to generate a CSV file from a rather complex Java object. The object is a Session with some attributes and a list of Strings and Messages who in turn have some attributes and a list of Comments that have some attributes. The session class…
Niels Masdorp
  • 2,534
  • 2
  • 18
  • 31
10
votes
1 answer

Validate every field in a single pass with SuperCSV

I'm trying to write a large number of rows (~2 million) from a database to a CSV file using SuperCSV. I need to perform validation on each cell as it is written, and the built-in CellProcessors do very nicely. I want to capture all the exceptions…
Conan
  • 2,288
  • 1
  • 28
  • 42
10
votes
3 answers

Using CsvBeanReader to read a CSV file with a variable number of columns

So I'm working on parsing a .csv file. I took the advice of another thread somewhere on StackOverflow and downloaded SuperCSV. I finally got pretty much everything working, but now I've run into a bug that seems difficult to fix. The problem occurs…
Bryce Sandlund
  • 487
  • 2
  • 5
  • 17
8
votes
3 answers

NoSuchMethodException: java.time.LocalDateTime.() reading CSV using Super CSV

I have written an entity that contains just a LocalDateTime to a CSV file using Super CSV's ICsvDozerBeanWriter and I am encountering an error when reading it back using a ICsvDozerBeanReader. I was able to successfully read and write a Date object…
Stuart Leyland-Cole
  • 1,243
  • 7
  • 19
  • 35
8
votes
1 answer

Parse CSV to multiple/nested bean types with OpenCSV?

I have various CSVs that contain some standard columns and some completely random fields: firstname, lastname, dog_name, fav_hat, fav_color bill,smith,fido,porkpie,blue james,smith,rover,bowler,purple firstname, lastname, car_type,…
xref
  • 1,707
  • 5
  • 19
  • 41
6
votes
1 answer

Using SuperCSV to Change Header Values

In line with this post about abilities of SuperCSV, can SuperCSV handle changing the values of the headers(column names only) read from the database? For example, the following code snippet details the Current State and the Expected State. Current…
todun
  • 165
  • 3
  • 8
6
votes
1 answer

Parsing double superCSV with comma as decimal separator?

I Want to parse a double with comma as decimal separator (',' instead of '.') using SuperCSV CellProcessor I want to parse the first element (0,35) to Double 0,35;40000,45 I have tried something like that : /** FRENCH_SYMBOLS */ private static…
hb.Sara
  • 177
  • 2
  • 13
5
votes
3 answers

Parsing enums with SuperCSV ICsvBeanReader

I parse CSV file and create a domain objects using supercsv. My domain object has one enum field, e.g.: public class TypeWithEnum { private Type type; public TypeWithEnum(Type type) { this.type = type; } public Type getType() { return…
5
votes
2 answers

write UTF-8 BOM with supercsv

I am using supercscv to write an utf-8 encoded csv. It produces a normal file but excel doesn't recognize it as utf-8 cause it's dumb, excel lost without the bom marker so any special characters are corrupted when opened with excel. Is there a way…
allaf
  • 53
  • 1
  • 1
  • 3
5
votes
4 answers

Super CSV (Java) - Read Files with Spaces in Column Names

I'm working with Super CSV and it looks like an amazing package. My only worry is how to work with columns with spaces in their names. No, I cannot go back and remove the spaces myself. These files will be given to me by the hundreds and I don't…
Justian Meyer
  • 3,623
  • 9
  • 35
  • 53
5
votes
1 answer

How to use encoding in supercsv getHeader

I'm using supercsv 2.1.0 to parse a CSV File with german words in it. The given CSV file has a header at the first line. In this header there are some mutated vowels like: Ä,ä, Ü,ö and so on. For example: Betrag;Währung;Info In my coding I'm trying…
1
2 3
13 14