This is a Light weight Library to Convert SQLite Database to Excel and Convert Excel to SQLite. I have already released version 1.0.0. It is suitable to export SQLite Database to Excel. But, In version 1.0.1 I have Included following features
Features
- Added Functionality to Import Excel into SQLite Database.
- Added Functionality to Export Blob into Image.
- Added Functionality to Export List of tables specified.
Sample App
The sample app in the repository is available on Google Play:
How to Download
Add the following library in your app level gradle filecompile 'com.ajts.androidmads.SQLite2Excel:library:1.0.1'
How to Use
Add Permission to Read External Storage in AndriodManifest.xml<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 SheetsqliteToExcel.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 SheetsqliteToExcel.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 SheetsqliteToExcel.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");
The following code is used to Import Excel from AssetsexcelToSQLite.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 directoryexcelToSQLite.importFromAsset(directory_path, new ExcelToSQLite.ImportListener() {
@Override
public void onStart() {
}
@Override
public void onCompleted(String dbName) {
}
@Override
public void onError(Exception e) {
}
});
Please Visit the Wiki Link for full Guidance on SQLite2XL(v1.0.1).Github Wiki LinkYou can Download Full source code from Github. If you Like this library, Please star it in Github.Github Link for Repo
No comments:
Post a Comment