Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create .CSV File in Android application

Tags:

android

csv

How can create .csv file in android application, in which we will store some data like some employe details?

like image 748
Manoj Kumar Avatar asked Aug 15 '26 05:08

Manoj Kumar


1 Answers

download library from here

and jar file add to your application.

Inside your application do

     CSVWriter writer = null;
try 
{
    writer = new CSVWriter(new FileWriter("/sdcard/myfile.csv"), ',');
    String[] entries = "first#second#third".split("#"); // array of your values
    writer.writeNext(entries);  
    writer.close();
} 
catch (IOException e)
{
    //error
}
like image 156
Narendra Avatar answered Aug 16 '26 19:08

Narendra



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!