Skip to content

SQLite2XL v1.0.2

AndroidMad / Mushtaq M A edited this page Jan 21, 2018 · 2 revisions

Import Excel into Database

The following snippet is used to initialize the library for Importing Excel

ExcelToSQLite excelToSQLite = new ExcelToSQLite(getApplicationContext(), "helloworld.db");

or To drop table while importing the Excel, use the following

ExcelToSQLite 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.importFromFile(directory_path, new ExcelToSQLite.ImportListener() {
	@Override
	public void onStart() {

	}

	@Override
	public void onCompleted(String dbName) {

	}

	@Override
	public void onError(Exception e) {

	}
});