Skip to main content

Generate a Sqlite3 database from a Office Open XML file.

Project description

Latest PyPI version GitHub license https://codecov.io/gh/Xgalan/xlsx2sqlite/branch/compat_py3.6-3.7/graph/badge.svg?token=R22KYIQ2UO

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

xlsx2sqlite is powered by Click and Tablib.

Compatibility

xlsx2sqlite is compatible with Python 3.7+.

Licence

GPLv3

Authors

xlsx2sqlite was written by Erik Mascheri.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xlsx2sqlite-0.4.6.tar.gz (32.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xlsx2sqlite-0.4.6-py3-none-any.whl (36.0 kB view details)

Uploaded Python 3

File details

Details for the file xlsx2sqlite-0.4.6.tar.gz.

File metadata

  • Download URL: xlsx2sqlite-0.4.6.tar.gz
  • Upload date:
  • Size: 32.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for xlsx2sqlite-0.4.6.tar.gz
Algorithm Hash digest
SHA256 d45dbf9a3152255ab6599ccd162906b5d228ff05d654241d536e4d7797e4da23
MD5 49e2fb26fac1ff8706ac959a6df1fe41
BLAKE2b-256 a3e3722b74b05b13d4ebd5925ca58a7a4de8f529331b85571dec6822947cdbb4

See more details on using hashes here.

File details

Details for the file xlsx2sqlite-0.4.6-py3-none-any.whl.

File metadata

  • Download URL: xlsx2sqlite-0.4.6-py3-none-any.whl
  • Upload date:
  • Size: 36.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for xlsx2sqlite-0.4.6-py3-none-any.whl
Algorithm Hash digest
SHA256 84e9a8579544cebd14d574f79b0ad56c665f21ba99fdc4b26a46ee1b0f33e893
MD5 776ecac0d74c84a30795269b0890c418
BLAKE2b-256 c6759b64741e8f3ec2718df0cd55e754bab4a824c514f099b7ac328a2f56d755

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page