How to Export SQLite Data into ExcelSheet – Android

DWQA QuestionsHow to Export SQLite Data into ExcelSheet – Android
kamal bunkar Staff asked 5 months ago

I want to export all SQLite data into a excel sheet. I am using Sqlite database having 5 tables.
How to export sqlite into excel sheet? is there any library available to export sqlite into excel sheet?

1 Answers
kamal bunkar Staff answered 5 months ago

You can export sqlite into excel sheet using a library . It is very easy to use. You can export single table into excel file OR you can export all tables OR some group of tables into a excel file.

Export Single SQLite table into Excel

This line is used to save the exported file in default location.
       SqliteToExcel sqliteToExcel = new SqliteToExcel(this, "helloworld.db");

This line is used to save the exported file in used preferred location.
       SqliteToExcel sqliteToExcel = new SqliteToExcel(this, "helloworld.db", directory_path);

This code snippet is used to Export a single table in a database to Excel Sheet

sqliteToExcel.exportSingleTable("table1", "table1.xls", new SQLiteToExcel.ExportListener() {
@Override
public void onStart() {

}
@Override
public void onCompleted(String filePath) {

}
@Override
public void onError(Exception e) {

}
});


Please click here to check complete code & details about SQL2XL library