Questions tagged [univocity]

univocity provides CSV/TSV/text file parsers for Java. Use this tag for questions when using their parser and also include other tags to indicate what other issues or frameworks are involved

Univocity provides open-source parsers with a wide range of features to read data by fields, into JavaBeans; writing delimited files, routines to provide short-cuts to common steps, and handling heading rows.

See also

120 questions
2
votes
1 answer

Validate parsed fields using Univocity Parser

I wanted to know if there is a way to check and validate a field when using the CsvRoutines package. Basically I want to process a row if the first column has only numbers and skip/possibly throw an exception otherwise. I'm guessing @Validate…
user2220232
  • 71
  • 1
  • 8
2
votes
1 answer

Univocity parser issue with empty string field

For fixed width parsing using multiple lookahead, the empty string causes issues (i.e., fieldX=' '). So for fixed format file with only 2 records, if the first record ends with a empty string field, then this causes a issue. The last field in the…
user518066
  • 1,277
  • 3
  • 23
  • 35
2
votes
1 answer

Univocity - Issue in file header validation during multiple reads

I'm using Univocity-Parser's bean iterator to read each line of file and get the bean. I have observed a weird behavior in the library when I'm attempting to read the same file mutiple times. Code when passing the File object to CsvParser…
2
votes
1 answer

Escaping delimiting character in univocity csv parser

I have a scenario where one of the rows in the data has the delimiting character in the content. 5 |0St"|"ring |field[1] Should always pass - quoted field separator where the delimiting character is | and it is also present in one of the columns as…
Sunil Kumar B M
  • 2,735
  • 1
  • 24
  • 31
2
votes
1 answer

CSV parsing with univocity library in java

I am using univocity to parse an large (6 GB) CSV in java. The CSV enrty is as below and can parse CSV. Any idea how to generate the output as below: CsvParserSettings settings = new CsvParserSettings(); …
2
votes
1 answer

How to read first few rows from CSV using univocity parser

How to stop parsing after reading few rows from CSV file using iterator/row processor in univocity parser? Update #1 I tried the below code and I'm getting empty rows. val parserSettings = new…
Gowrav
  • 627
  • 7
  • 22
2
votes
1 answer

Univocity parser - false delimiter autodetection when too little information given

I set the parser to detect the delimiters automatically CsvParserSettings settings = new CsvParserSettings(); settings.detectFormatAutomatically(); I have only 1 single record : 47W2E2qxPs, http://usda.gov/mattis.html What I got : code:…
Oleg
  • 1,479
  • 3
  • 21
  • 42
2
votes
1 answer

Using univocity to parse two different csv files and write into new csv file

I always use univocity parser in my java program to compare csv files. It works excellent and is much faster. But the problem is, this time am trying to parse two different large volume csv files with complex values and print the difference in new…
Bananas
  • 141
  • 12
2
votes
1 answer

Univocity - Writing a list property into multiple lines

I have a bean Person who has a List of "memberOf". Now what I want is, to write one row of this bean per entry of "memberOf" (the project requires it). All my code is written into around beans but I have this issue. Eg: public class Person { …
snap98
  • 23
  • 3
2
votes
3 answers

How to concatenate string after CSV parsing based on certain rules - row by row

I am reading CSV list using univocity parser - https://www.univocity.com/pages/parsers-tutorial. Below is how test.csv looks like Active;3189;Active on this date 2015-03-15-17.03.06.000000 Catalog;3189;This is for date…
Sks
  • 612
  • 7
  • 23
2
votes
1 answer

Univocity parser - parse csv row into existing bean instance

I'm trying to parse a csv file into new and existing instances of a bean, using univocity parser. The csv is generated by using univocity BeanWriterProcessor, for a set of beans that I will call set A. Now I want to read the csv back, doing the…
Matthis
  • 43
  • 8
2
votes
1 answer

Throw exception if the expected header field is not in the received .csv file

Is it possible to throw exception when the expected header fields are not present in csv file, while parsing it via univocity parser
Priya
  • 1,096
  • 4
  • 15
  • 32
2
votes
1 answer

Error while reading very large files with spark csv package

We are trying to read a 3 gb file which has multiple new line character in one its column using spark-csv and univocity 1.5.0 parser, but the file is getting split in the multiple column in some row on the basis of newline character. This scenario…
Rajat Mishra
  • 3,635
  • 4
  • 27
  • 41
2
votes
1 answer

Univocity - Is it possible to iterate using the MultiBeanListProcessor?

One of the files I am parsing consist of two parts that I need to logically split into two different beans. I have found that the MultiBeanListProcessor is a great way to do this. I used test example 14 as source for my code. Given the following…
Sander_M
  • 1,109
  • 2
  • 18
  • 36
2
votes
1 answer

Using Univocity CSV parser to parse two different files having same definition but varies in the number of column count

I'm using Univocity parser to parse CSV files and populating them in a Bean. The problem I'm facing is that I have two different files. Both the files are same in structure but they vary in the number of columns. They both refer the same Bean…
Maverick
  • 1,519
  • 18
  • 32