GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - li-yu/SQLiteToExcel: A simple lib for Android to export SQLite to Excel, also Excel to SQLite.

BranchesTags
Open more actions menu

Latest commit

 

History

38 Commits
38 Commits

Folders and files

NameName
Last commit message
Last commit date
app-kt
app-kt
 
 
app
app
 
 
gradle/wrapper
gradle/wrapper
 
 
sqlitetoexcel-kt
sqlitetoexcel-kt
 
 
sqlitetoexcel
sqlitetoexcel
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README-CN.md
README-CN.md
 
 
README.md
README.md
 
 
build.gradle
build.gradle
 
 
gradle.properties
gradle.properties
 
 
gradlew
gradlew
 
 
gradlew.bat
gradlew.bat
 
 
settings.gradle
settings.gradle
 
 

Repository files navigation

SQLiteToExcel

Download

中文版 README

The SQLiteToExcel library integrates Apache POI and some basic database query operations, making it easier to convert between SQLite and Excel.

From v1.0.5, not support xlsx format any more, because poi ooxml lib and other dependencies are so big( > 10 MB), and there are some strange problems on Android.

From v1.0.8, support custom SQL query.

Version history

Release Notes

How to use

1. Add Gradle dependencies

compile 'com.liyu.tools:sqlitetoexcel:1.0.10'

2. SQLite -> Excel demo

new SQLiteToExcel
                .Builder(this)
                .setDataBase(databasePath) //Required. Tips: internal database path can be got by context.getDatabasePath("internal.db").getPath()
                .setTables(table1, table2) //Optional, if null, all tables will be export. 
                .setOutputPath(outoutPath) //Optional, if null, default output path is app ExternalFilesDir. 
                .setOutputFileName("test.xls") //Optional, if null, default output file name is xxx.db.xls
                .setEncryptKey("1234567") //Optional, if you want to encrypt the output file.
                .setProtectKey("9876543") //Optional, if you want to set the sheet read only.
                .start(ExportListener); // or .start() for synchronous method.

Custom SQL:

new SQLiteToExcel
                .Builder(this)
                .setDataBase(databasePath)
                .setSQL("select name as USER_NAME, price as USER_PRICE from user where name like '%FRANK%'")
                .start(ExportListener);

3. Excel -> SQLite demo

new ExcelToSQLite
                .Builder(this)
                .setDataBase(databasePath) // Optional, default is "*.xls.db" in internal database path.
                .setAssetFileName("user.xls") // if it is a asset file.
                .setFilePath("/storage/doc/user.xls") // if it is a normal file.
                .setDecryptKey("1234567") // Optional, if need to decrypt the file.
                .setDateFormat("yyyy-MM-dd HH:mm:ss") // Optional, if need to format date cell.
                .start(ImportListener); // or .start() for synchronous method.

4. Thanks (how to support xlsx?)

  • https://github.com/centic9/poi-on-android
  • https://github.com/FasterXML/aalto-xml
  • https://github.com/johnrengelman/shadow

5. Precautions

  • When read or write external file, Android 6.0 and above need to deal with run-time permissions.
  • When convert Excel to SQLite, take excel sheet first row as the database table column name, please refer to the style demo.
  • Currently only blob field is supported as a picture, because I do not know whether byte [] is a file or a picture.
  • The database files must be located under ```/data/data/package name/databases/` ``, and are usually located in this directory.

About me

  • Email: [email protected]
  • Weibo: @呵呵小小鱼

About

A simple lib for Android to export SQLite to Excel, also Excel to SQLite.

Resources

Readme
Apache-2.0 license
Activity

Stars

290 stars

Watchers

6 watching

Forks

52 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.