Generate a Sqlite3 database from a Office Open XML file.
Project description
Generate a Sqlite3 database from a Office Open XML file. Read the xlsx2sqlite documentation.
Usage
First create a .INI config file that you will pass as an argument to the xlsx2sqlite command line tool. This will serve as a model to import data from the .xlsx file.
The INI file must contains this section:
PATHS
Optional sections, see below:
EXCLUDE
Example of a configuration:
[PATHS]
; declare the paths of the files to be read.
root_path = baserootpath/
xlsx_file = %(root_path)s/exampletoimport.xlsx
db_file = %(root_path)s/databasename.db
db_url = sqlite:///%(db_file)s
sql_views = %(root_path)s/views
; declare to import a worksheet like this :
; name of the worksheet to import
[SheetName1]
; comma-separated list of the columns to import
columns = Col1,Col2,Col3
; composite primary key is supported:
primary_key = Col1,Col2
[SheetName2]
; valid model keywords are:
columns = Col1,Col2
primary_key = id
unique = Col2
not_null = Col2
; add if the row with the header is not the first row of the worksheet
header = 2
Optional “exclude” section, use if you don’t want to import some section of the ini file, this is useful in example for co-exist with some other configuration file.
[EXCLUDE]
sections = SECTION1,section2,etc. ; use a list of comma-separated values.
Installation
Install the release from PyPI:
$ pip install xlsx2sqlite
Installing from source, a virtualenv is recommended:
$ pip install --editable .
Requirements
Compatibility
xlsx2sqlite is compatible with Python 3.7+.
Licence
GPLv3
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for xlsx2sqlite-0.4.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 84e9a8579544cebd14d574f79b0ad56c665f21ba99fdc4b26a46ee1b0f33e893 |
|
MD5 | 776ecac0d74c84a30795269b0890c418 |
|
BLAKE2b-256 | c6759b64741e8f3ec2718df0cd55e754bab4a824c514f099b7ac328a2f56d755 |