Write data in a specific column in CSV File!!!

913 views
Skip to first unread message

Muzzamil

unread,
Jul 29, 2012, 5:41:13 AM7/29/12
to seleniu...@googlegroups.com
Hello all,

Here is my code,


import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;

public class WriteToFileCsv
 {
  public static void main(String[] args) throws IOException
  {
   FileWriter fw = new FileWriter("WriteTest.csv");
   PrintWriter out = new PrintWriter(fw);
   // ',' divides the word into columns
   out.print("This");// first row first column
   out.print(",");
   out.print("is");// first row second column
   out.print(",");
   out.println("amazing");// first row third column
      
   out.print("It's"); // second row first column.
   out.print(",");
   out.print("really");// second row second column
   out.print(",");
   out.print("amazing");// second row third column
     
   //Flush the output to the file
   out.flush();
      
   //Close the Print Writer
   out.close();
      
   //Close the File Writer
   fw.close();      
  }
}



but i want to enter data in a specific column like 4th, 5th ...etc



how i can modify this code.


Pls suggest


Thanks,
Muzzamil

Krishnan Mahadevan

unread,
Jul 29, 2012, 6:03:14 AM7/29/12
to seleniu...@googlegroups.com
Please post your query on a Java forum. Your query has nothing to do with Selenium! Please help keep the forum relevant to ONLY selenium related queries!
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 


--
Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/

Darrell Grainger

unread,
Jul 29, 2012, 7:04:26 PM7/29/12
to seleniu...@googlegroups.com
As noted, this has nothing to do with Selenium. I'd recommend searching for "Java CSV library" in Google. You should find a library which will do what you wnt.

Muzzamil

unread,
Jul 30, 2012, 1:13:03 AM7/30/12
to seleniu...@googlegroups.com
Ok

On Mon, Jul 30, 2012 at 4:34 AM, Darrell Grainger <darrell....@gmail.com> wrote:
As noted, this has nothing to do with Selenium. I'd recommend searching for "Java CSV library" in Google. You should find a library which will do what you wnt.
--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/26kqMTynxAcJ.
Reply all
Reply to author
Forward
0 new messages