Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How to import csv generated file via API

 Hello,
I exported a workitem query result from RTC in csv. 
What is the best way to read the file in Java via API? I tried the following but it doesn't work. 
Thanks for your help.
BufferedReader br = null;
String line = "";
char cvsSplitBy = "\t";
 try {      
br = new BufferedReader(new FileReader("c:/output.csv"));
while ((line = br.readLine()) != null) {     
            .................
         }
.......
}

0 votes

Comments

hm.. thats what I use all the time.,  or "," for comma separated 


be careful on export to select tab separated.. 

 I don't have an option to select anything when I export from the RTC web UI....



2 answers

Permanent link
Since you are dealing with a generic Java issue, you don't need to restrict your focus on jazz.net only. Google "java csv reader" will give you quite a few options such as opencsv.

0 votes


Permanent link
You can search for a generic way of handling this as suggested, but if you like to know how the RTC SDK reads
in CSV files you can have a look at the following method:
com.ibm.team.workitem.rcp.core.internal.csv.CSVTokenizer.detectDelimiter

In particular this method creates the BufferedReader like the following:
String firstLine;
String delim= userDelim;
BufferedReader br= null;
try {
File csvFile= new File(csvFileName);
br= new BufferedReader(new InputStreamReader(new DataInputStream(new FileInputStream(csvFile)), detectCharset(csvFile)));
if ((firstLine= br.readLine()) != null) {

}
} finally {
if(br != null) {
br.close();
}
}
 

0 votes

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details

Question asked: Mar 10 '14, 5:05 p.m.

Question was seen: 3,901 times

Last updated: Mar 12 '14, 4:51 a.m.

Confirmation Cancel Confirm