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
0
votes
1 answer

OpenCSV Get Value from last row and specific column

I am trying to get the values from the second last row and third column in a semicolon separated file. I can't seat to get the values from the second last row and the third column. I have searched for a method to achieve this but it has been…
user
  • 158
  • 6
  • 19
0
votes
2 answers

how to display csv file from sql database to php webpage?

I am developing one php website with sql server 2008. I have a feature to attach a document and display it. I am storing the attached document in database. for that my table field is "image". This is working fine with all document. but its not…
Mausami
  • 692
  • 1
  • 13
  • 24
0
votes
1 answer

Creation of Batches from CSV resulting in erroneous state

I'm trying to make batches from a CSV file written using CSVWriter of opencsv as: CSVWriter writer = new CSVWriter(new FileWriter(filePath+createFileName), ',', CSVWriter.DEFAULT_QUOTE_CHARACTER); And BufferedReader to read the written file. The Csv…
Sanchit
  • 428
  • 1
  • 5
  • 24
0
votes
2 answers

Is this database dump design ok?

I have written a Java program to do the following and would like opinions on my design: Read data from a CSV file. The file is a database dump with 6 columns. Write data into a MySQL database table. The database table is as follows: CREATE…
TheCoder
  • 8,413
  • 15
  • 42
  • 54
0
votes
2 answers

How to select specific line from CSV file using unique value

I have a few line CSV file which contains these values: 2, Joe, BMW 6, Mark, Audio 7, Jeff, Fiat 9, Mike, Toyota Now I know how to select specific line using OpenCSV ie. line 1, 2 or 3 etc. But I don't know how to select line which has first value…
0
votes
3 answers

how to fill class from partial csv file

I have class in Java: class data { private String id; private String name; private String phone; } and I need to fill data from CSV file. But not all columns in CSV file are mandatory, or could be in different order. CSV Example1: id,…
user1700214
  • 1,375
  • 2
  • 9
  • 6
0
votes
2 answers

Grails error using HttpServletResponse to export file for download

I am using opencsv in my Grails application to export attributes from my Person domain class to CSV. I am receiving the following error, however: Servlet.service() for servlet [default] in context with path [/myapp] threw exception [Request…
littleK
  • 19,521
  • 30
  • 128
  • 188
0
votes
1 answer

Reading CSV data using Sql Server Import Export Utility

I am reading a CSV file using SSIS tool but problem is that data which I read is in wrong format means to say data of columns mismatch. Like Note column data which contains message comes in Id column etc. I tried all types of separator and text…
Awadhendra
  • 355
  • 2
  • 10
  • 34
0
votes
2 answers

Android, opencsv and writing to an assets file

I can read from a csv file in the assets folder, using opencsv. However, writing to the file was a bit more mysterious. I do the following to open up a file in the /assets folder for reading: CSVReader reader = new CSVReader(new…
user1341676
0
votes
1 answer

VBA import last modified csv file into access

i need help with open last modified csv in access. Csv files are in some folder FF. I have some code below, but error is in import chosen csv file into access Can anyone idea with this line: DoCmd.TransferText acImportDelim, "", "Tablename",…
lama27
  • 59
  • 1
  • 1
  • 6
0
votes
4 answers

how to read utf-8 chars in opencsv

I am trying to read from csv file. The file contains UTF-8 characters. So based on Parse CSV file containing a Unicode character using OpenCSV and How read Japanese fields from CSV file into java beans? I just wrote CSVReader reader = new…
tom
  • 1,223
  • 6
  • 16
  • 26
0
votes
1 answer

How to determine if char origin is from keyboard (while reading file content)

I'm parsing CSV files, and I might sometime bump into illegal files , like jpeg or pdf and etc... So when I parse the file content I want to determine if the char is legal (came from keyboard) like a 5 & % ! and etc... But not chars like this : � …
Daniel
  • 36,833
  • 10
  • 119
  • 200
0
votes
1 answer

Adding Open CSV reader library to GWT- getting error message

Im using this library to parse CSV files in my GWT app. However, It compiles fine however, Im getting an error at runtime in the console. In order to include it in my GWT project, I also copied the jar file into my WEB-INF->libfolder. Then I added…
banditKing
  • 9,405
  • 28
  • 100
  • 157
0
votes
3 answers

Is there any way to change value of a particular cell in a csv file in java?

I have gone through other questions regarding this on StackOverflow but libraries mentioned there only allow to read or write. Some of them do allow partial read or write like SuperCSV but no library can be used for updating value of a particular…
rishiag
  • 2,248
  • 9
  • 32
  • 57
0
votes
1 answer

Exporting CSV really strange formatted

What am i doing? I am exporting my sqlite database into a csv -- atleast i try to I've done this both manually and with "OpenCSV". With both methods I get very strange results. They just seem not well formatted. Neither the columns (which are…
Aeefire
  • 888
  • 10
  • 25