Questions tagged [opencsv]

opencsv is a simple csv (comma-separated values) parser library for Java

What is opencsv ?

opencsv is a simple csv (comma-separated values) parser library for Java. It was developed in response to a lack of csv parsers with commercial-friendly licenses.

Where can I get it?

Source and binaries are available from Sourceforge. You can check out the javadocs online.

What features does opencsv support?

opencsv supports all the basic csv-type things you're likely to want to do:

  • Arbitrary numbers of values per line
  • Ignoring commas in quoted elements
  • Handling quoted entries with embedded carriage returns (ie entries that span multiple lines)
  • Configurable separator and quote characters (or use sensible defaults)
  • Read all the entries at once, or use an Iterator style model
  • Creating csv files from String[] (ie. automatic escaping of embedded quote chars)
1008 questions
-2
votes
1 answer

write CSV file with modification

im using a large csv file having large dataset about 17 attribute and approx 40000 rows. i want to write ith position of each rows value in reverse order(1st row ith ","separated value is replace with 40000th ith"," separated...2nd is replace…
-2
votes
7 answers

remove '#' symbol from the beginning of the string in java

Sample data in csv file ##Troubleshooting DHCP Configuration #Module 3: Point-to-Point Protocol (PPP) ##Configuring HDLC Encapsulation Hardware is HD64570 So i want to get the lines as #Troubleshooting DHCP Configuratin Module 3: Point-to-Point…
user3727850
  • 143
  • 2
  • 3
  • 11
-2
votes
1 answer

Process unstructured and multiple line CSV in hadoop

I would like to process data in Hadoop Mapreduce, I am having data below format with unstructured, multiple line and un-terminated quotations. 2/1/2013 5:16,Edward Felton,2,8/1/2012 3:57,Working on all the digital elements for our big event in…
srinivasa
  • 13
  • 2
  • 5
-2
votes
1 answer

Dump SQL tables to CSV using OpenCSV

I am trying to write the data from ResultSet to csv file using Netbeans and OpenCSV. I added OpenCSV library: import au.com.bytecode.opencsv.*; ... try { CSVWriter writer = new CSVWriter(new FileWriter("C:\\test2.csv"), ','); …
-2
votes
2 answers

Java simple line parser

I could see bunch of java parsers like OpenCSV, antlr, jsapar etc, but I dont see any of those with ability to specify both custom line seperator and column seperator? Do we have any such easy to use libraries. I dont want to write one using Scanner…
Satish
  • 95
  • 2
  • 10
-3
votes
1 answer

Display CSV files in a JTable with OpenCSV

I want to import a CSV file into a JTable using the OpenCSV library. All the examples found on the net are related to command line display, the only code found here does not work because JTable needs Object[][] and a String[]: CSVReader reader = new…
Bishop
  • 1
  • 5
-3
votes
1 answer

Cant import my csv file in jupyter notebbok

I have put my CSV file in the same folder as running jupyter notebook, still can't able to import it.
-3
votes
1 answer

Attempt to invoke virtual method on a null object reference (Error when adding strings)

I'm trying to build a simple app that takes in data and outputs it as a CSV. Everything is working, but now I am at the point where I am outputting the CSV. When I add the string declarations, I get this error: Caused by:…
CAtkins
  • 11
  • 5
-3
votes
1 answer

Converting .csv file from UTF-8 to iso 8859-1 Java

I have to read .csv file in Java, and then convert it from UTF-8 to iso 8859-1. Any hints ? I know I have to use opencsv library to read file in java, but I have no idea how to do converting. Thanks a lot for all tips.
mavrise
  • 611
  • 1
  • 5
  • 5
-3
votes
2 answers

New line character in notepad

I am using openCSV to generate .txt file. I am able to generate the file successfully, but the new line character which i have given were not reflecting in the notepad. But when open the same file in notepad++ it is working fine. Is there any…
Garry Steve
  • 129
  • 2
  • 11
-3
votes
2 answers

How do I change this so it fails the way I want?

I think the following code stops if it encounters any error, period. public static void exportDatapointsToCSV(List datapointList, File exportDir) { SimpleDateFormat sdf = new SimpleDateFormat("MMM dd, yyyy (h:mm a)", Locale.US); …
-3
votes
1 answer

JSON Key and value to csv file in python

Here is my file_t.JSON am writing from Request content to a csv/json file {"w1":"R"} {"w2":"R2"} {"w3":"R3"} {"w4":"R4"} {"w5":"R5"} I'm expecting that my code below should give me the below result Expecting output.csv w1 r w2 R2 w3 R3 W4 R4 w5…
-3
votes
2 answers

Aggregate CSV data with group by in Java

I need to aggregate CSV data with group by in Java. My csv file looks like this: Numero, NumeroWsn, NoeudAdress, PacketRece, NoeudsRece, Hello 1436136640477044,wsn430-8,NA:b27b,Packet recevied from,RX: b0b4, Hello…
-3
votes
2 answers

"main" java.lang.ArrayIndexOutOfBoundsException: 3

i want to extract a particular single column value of CSV file.so i had used dataset of CSV FILE having Instances:45211 and Number of Attributes:17. i had try with this code ..but its give me error like this.. "main"…
vivek patel
  • 23
  • 1
  • 7
-3
votes
3 answers

OpenCVS: How to get an objects all field values as array?

I have 3 domain classes like below and I need their values as a string array like in the example. It is very time consuming and error prone to write all fields one by one like this, maybe there is a quicker way? It will iterate over all fields and…
Spring
  • 11,333
  • 29
  • 116
  • 185
1 2 3
67
68