SQLite to Excel Version 1.0.2 released included with the following features
Features
1.0.2
Added support to add new column from excel while importing, if the column is not exists with your Existing SQLite Database.How to Download
add the following library in your app level gradle filecompile 'com.ajts.androidmads.SQLite2Excel:library:1.0.2'
How to Use
The steps to use this Library
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Export SQLite to 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) {
}
});
This following code snippet is used to Export a list of table in a database to Excel Sheet
sqliteToExcel.exportSpecificTables(tablesList, "table1.xls", new SQLiteToExcel.ExportListener() {
@Override
public void onStart() {
}
@Override
public void onCompleted(String filePath) {
}
@Override
public void onError(Exception e) {
}
});
This code snippet is used to Export a every table in a database to Excel Sheet
sqliteToExcel.exportAllTables("table1.xls", new SQLiteToExcel.ExportListener() {
@Override
public void onStart() {
}
@Override
public void onCompleted(String filePath) {
}
@Override
public void onError(Exception e) {
}
});
Import Excel into Database
The following snippet is used to initialize the library for Importing ExcelExcelToSQLite excelToSQLite = new ExcelToSQLite(getApplicationContext(), "helloworld.db");
or
To drop table while importing the Excel, use the followingExcelToSQLite excelToSQLite = new ExcelToSQLite(getApplicationContext(), "helloworld.db", true);
The following code is used to Import Excel from Assets
excelToSQLite.importFromAsset("assetFileName.xls", new ExcelToSQLite.ImportListener() {
@Override
public void onStart() {
}
@Override
public void onCompleted(String dbName) {
}
@Override
public void onError(Exception e) {
}
});
The following code is used to Import Excel from user directory
excelToSQLite.importFromAsset(directory_path, new ExcelToSQLite.ImportListener() {
@Override
public void onStart() {
}
@Override
public void onCompleted(String dbName) {
}
@Override
public void onError(Exception e) {
}
});
Follow Us
Were this world an endless plain, and by sailing eastward we could for ever reach new distances