I am trying to organize my data in .CSV file.I want to put my data in a particular row so i tried putting "\n" but it is not working.Please help me in putting data to a particular row.Thank you in advance..
public void writeData(String data,String strFilePath)
        {
            PrintWriter csvWriter;
            try
            {
                File file = new File(strFilePath);
                if(!file.exists()){
                    file = new File(strFilePath);
                }
                csvWriter = new  PrintWriter(new FileWriter(file,true));
                csvWriter.print(data+","+"hello");
                csvWriter.append('\n');
                csvWriter.print("world");
                csvWriter.close();
            }
            catch (Exception e)
            {
                e.printStackTrace();
            }
        }
                csvWriter.flush()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With