Questions tagged [apache-commons-csv]

Commons CSV reads and writes files in variations of the comma-separated value (CSV) format.

Apache Commons CSV, an open-source Java library for reading and writing text files in various delimited-text formats, including:

114 questions
0
votes
2 answers

How Should I read CSV By Grouping Column of Same Value

I have a task to read a CSV file then do some logic and then create a JSON for that. I am kind of stuck with required logic before creating JSON, I need to set Max PR VALUE against the SK as PR for all the same SK's. My…
USM
  • 580
  • 1
  • 10
  • 21
0
votes
1 answer

CSV file genereated using java when opened in excel sheet formats date for only few cells

I have written following code: CSVFormat csvFileFormat = CSVFormat.DEFAULT.withRecordSeparator("\n").withEscape('\\'); FileWriter fileWriter = new FileWriter(csvFile); CSVPrinter csvFilePrinter = new CSVPrinter(fileWriter,csvFileFormat); function…
Radhika Kulkarni
  • 298
  • 1
  • 4
  • 19
0
votes
0 answers

Using a CSV for a class in a jar file

I am creating a Jar file to store common code for some of my other applications. Within one of the classes, I want to essentially load a csv file into an object, and allow applications that use the jar to access this object. I am using Java 8 and…
Kyle Grage
  • 715
  • 1
  • 9
  • 15
0
votes
0 answers

How to parse a CSV file using A1/B2 as cell value using apache commons CSV?

My CSV file cell contains B1 B2 ,C3,.. as records. Can I parse such CSV file using Apache commons CSV library? I know WE can define custome heders for columns(like A,B,..) but can we define rows also as numbers?
Ratha
  • 9,434
  • 17
  • 85
  • 163
0
votes
0 answers

Apache CSV: Parsing quoted data with separator

I have CSV data like this (fully quoted, comma separated, records finishes with ';': "595010","MHD-10 SKIBUS Usti n.L., Divadlo - Telnice, Zadni Telnice","25013891","A","A","0","0","0","0","","","","","23122017","11032018","1","1"; I configured my…
Viktor Sinelnikov
  • 1,631
  • 2
  • 16
  • 26
0
votes
1 answer

IllegalArgumentException when using parsing CSV using apache commons csv - CSVFormat

I am parsing a CSV file using Apache commons CSV using the following code: CSVFormat csvFileFormat = CSVFormat.EXCEL.withHeader().withQuoteMode(QuoteMode.MINIMAL); On some of the CSV files I am getting the following…
JavaSheriff
  • 7,074
  • 20
  • 89
  • 159
0
votes
1 answer

How to parse a csv file encoded in GB18030 with Apache Commons CSV

I have a csv file encoded with GB18030, and I want to use apache commons CSV to parse the file and get the chinese characters inside the file. How to do this? as I got some wired character using default configuration. Thanks
cinqS
  • 1,175
  • 4
  • 12
  • 32
0
votes
2 answers

Getting data from CSVRecord without having access to header values

I'm decrypting a string to reveal multiple comma separated values and I want to access the individual pieces of information, but the encrypted string does not include the header values. I am aware that when reading CSV files information at a…
cryptiblinux
  • 29
  • 3
  • 12
0
votes
1 answer

Downloading and Parsing a CSV with Apache Camel

I want to download and parse a large CSV using camel-csv and I can't figure out a solution that I'm satisfied with. camel-csv seems to be designed to read and process files placed on disk. I want to download a list of URL's via HTTP and parse the…
Martinffx
  • 2,426
  • 4
  • 33
  • 60
0
votes
1 answer

EoF error for CRLF within quotes (common-csv)

I'm getting following error while reading csv from hdfs- java.lang.RuntimeException: java.io.IOException: (startline 1) EOF reached before encapsulated token finished when i looked into csv file found CRLF (newline) within column is causing…
insomniac
  • 155
  • 2
  • 15
0
votes
3 answers

Ignoring delimiter in quote-enclosed field in Apache Commons CSV / OpenCSV?

I have to parse a csv file which has fields that can look like the following: ("FOO, BAR BAZ", 42) And yield the two fields: FOO, BAR BAZ 42 I'm not sure how to do this succinctly using Apache Commons CSV or OpenCSV, so I'm looking for some…
0
votes
2 answers

Apache CSV parser is not working on tab delimited data with quotation marks

I would like to parse a Google eBook transaction report. I opened it in Notepad++ to see precisely the filed and record delimiters. It is a tab delimited file, every header field and data field are surrounded by quotation marks. The first two lines…
Roland
  • 327
  • 7
  • 19
0
votes
1 answer

Apache commons csv string intern

In my CSV files, there are some strings that appear many time. I see in visualVM that in my app there are a lot of instances of the same string. How to use string intern with Apache commons CSV ?
mar3
  • 11
0
votes
1 answer

Generate/download CSV file without storing on server

I'm using the apache.commons.csv library in Java to generate CSV and make it downloadable without storing on server using following code: try (OutputStreamWriter osw = new OutputStreamWriter(response.getOutputStream())){ csvWriter = new…
0
votes
1 answer

CSVFormat.RFC4180 ignores quoted values in .csv file

I have .csv file that has quoted values Gender,ParentIncome,IQ,ParentEncouragement,CollegePlans "Male",53900,118,"Encouraged","Plans to attend" "Female",24900,87,"Not Encouraged","Does not plan to attend" "Female",65800,93,"Not Encouraged","Does not…
newprint
  • 6,936
  • 13
  • 67
  • 109