SQlite database programmatically convert into Excel file format in Android

◇◆丶佛笑我妖孽 提交于 2019-12-18 02:55:29

问题


I am developing android app where SQlite as a database.I want to export my android app database in to excel file format programmatically, so that normal people can read their database easily.If it is possible than please give me hint or not than help me to convert any other file format like text file or other. thanks for voting...


回答1:


Excel reads CSV, so this would by far be your easiest option. Have a look at opencsv

http://opencsv.sourceforge.net

it contains pretty much everything you need. The process becomes as simple as:

  1. read the data you wish to export from Sqlite.
  2. write the results into a csv file (remember to name it *something***.csv**, so excel will know its a csv file)

and thats it really :)

EDIT: Based on your comments below, I suggest you take a look at this thread

How can I use external JARs in an Android project?

EDIT for gradle dependencies

Add compile 'com.opencsv:opencsv:4.1' to app gradle. That's it. No need to add jars.

Reference: http://opencsv.sourceforge.net/dependency-info.html



来源:https://stackoverflow.com/questions/13068774/sqlite-database-programmatically-convert-into-excel-file-format-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!