On my app I have an object of records, let's say I have todo a quiz with more than 5 guys, so I can then get the results of all of them and I have an Object with all of that information, is it possible to convert this Object to an Excel file? For example :
|---------------------|------------------|
| Quiz | Question 1 |...
|---------------------|------------------|
| Quiz Name | What's 1+1 |...
|---------------------|------------------|
Something like this, to know each user what answered and its score, all of it I have it on my Object.
And then if I can send it via Mail the .xls or whatever format.
For example I'll need Quiz name and if I can add more about this quiz is ok, but then I need to add all of users have asked this quiz (another object from api) so I could get the name and the score.
I'd like to have a .csv
or an Excel
whatever where it says explicit :
Let's say I have a list of :
So I want to populate it to the .csv
or an Excel
whatever
A CSV file is a simple comma separated text file. In your case, the format will be:
Quiz,Question 1
Quiz Name,What's 1+1
As long as you are able to write records in above format to a file with extension "csv", you will be able to open it in excel and email it too.
Please refer to following stackoverflow post.
How to create a .csv on android
You can use Open CSV also.
<dependency>
<groupId>com.opencsv</groupId>
<artifactId>opencsv</artifactId>
<version>4.1</version>
</dependency>
you can refer this.
Java Object to CSV file
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