Skip to main content

python-xlsxio

Wrapper for c library xlsxio

Since the main library is written in c, and its wrapper is written in cython (which compiles in c), the read speed is much faster than libraries written in python (as can be seen in the benchmarks).

This library also has streaming reading and does not load memory.

Of the minuses, you should know in advance the data types of each column, or read everything as a string or bytes.

Install

Just: pip install python-xlsxio

If you want speed up about 5% you can build from source:

pip install cython python-xlsxio --no-binary python-xlsxio

Benchmarks read xlsx

How is testing you can see in benchmark/benchmark.py

File xlsx generated with openpyxl and conteins mixed types, how is generated you can see in benchmark/generate_xlsx.py

Big file - file with 100000 rows

Small file - file with 100 rows

Test machine: Linux 5.4.44-1-MANJARO #1 SMP PREEMPT Wed Jun 3 14:48:07 UTC 2020 x86_64

Title Min sec execution Calls/sec
xlsxio read big file with types 1.08584 0.92095
xlsxio read big file without types 0.93787 1.06625
xlsxio read big file without types all in bytes 0.88268 1.13292
xlsxio read big file with types from memory 1.09569 0.91267
xlsxio read small file with types 0.00128 780.58583
xlsxio read small file without types 0.00117 855.33007
xlsxio read small file without types all in bytes 0.0011 905.32902
xlsxio read small file with types from memory 0.00129 776.06377
openpyxl read big file 6.34512 0.1576
openpyxl read big file from memory 6.35287 0.15741
openpyxl read small file 0.01131 88.40829
openpyxl read small file from memory 0.01134 88.19221
xlrd read big file 4.10823 0.24341
xlrd read big file from memory 4.0911 0.24443
xlrd read small file 0.00486 205.74491
xlrd read small file from memory 0.00503 198.75329
sxl read big file 4.9788 0.20085
sxl read big file from memory 4.96794 0.20129
sxl read small file 0.00627 159.49498
sxl read small file from memory 0.00619 161.4445
xlsx2csv read big file 6.53466 0.15303
xlsx2csv read big file from memory 6.56024 0.15243
xlsx2csv read small file 0.01157 86.4205
xlsx2csv read small file from memory 0.01147 87.21896

Fast start with read xlsx

import xlsxio
xlsxio_reader = xlsxio.XlsxioReader('file.xlsx')
sheet = xlsxio_reader.get_sheet()
data = sheet.read_data()
sheet.close()
xlsxio_reader.close()

print(data)

Or simply:

import xlsxio
with xlsxio.XlsxioReader('file.xlsx') as reader:
    with reader.get_sheet() as sheet:
        data = sheet.read_data()

print(data)

Full example for reading xlsx file in sheet hello, and not reading at all in memory (write only rows, which have True in 5 column):

import xlsxio
import datetime

types = [str, str, float, int, bool, datetime.datetime]
with xlsxio.XlsxioReader('file.xlsx') as reader:
    with reader.get_sheet('hello', types=types) as sheet:
        header = sheet.read_header()
        only_active = []
        for row in sheet.iter_rows():
            if row[4]:
                only_active.append(row)
print(only_active)

Usage read xlsx

XlsxioReader

Object of xlsx

def __init__(self, filename, encoding: str = 'utf-8')

Inittializating XlsxioReader

  • filename - str (path to filename), bytes (loaded in memory file) or file like object (not BytesIO)
  • encoding - encoding of xlsx file

def get_sheet_names(self) -> tuple

Return tuple of sheet names in xlsx file

def get_sheet(self, sheetname: Optional[str] = None, flags: int = XlsxioReadFlag.SKIP_EMPTY_ROWS, types: Optional[Iterable[type]] = None, default_type: type = str) -> XlsxioReaderSheet

Return XlsxioReaderSheet object

  • sheetname - name of sheet (if None, returns first sheet)
  • flags - default is XlsxioReadFlag.SKIP_EMPTY_ROWS (Read more about flags). All possible flags:
    • XlsxioReadFlag.SKIP_NONE
    • XlsxioReadFlag.SKIP_EMPTY_ROWS
    • XlsxioReadFlag.SKIP_EMPTY_CELLS
    • XlsxioReadFlag.SKIP_ALL_EMPTY
    • XlsxioReadFlag.SKIP_EXTRA_CELLS
    • XlsxioReadFlag.SKIP_HIDDEN_ROWS
  • types - list of types by columns. example, if first column is integer, second - str, end third - float, you can pass: types=[int, str, float]. if fourth column will be, then will it default_type. Possible types:
    • bytes
    • str
    • int
    • float
    • datetime.datetime
    • bool
  • default_type - default type of columns if types not passed, default str

def close(self)

Closes reader

XlsxioReaderSheet

Object of sheet

def __init__(self, xlsxioreader: XlsxioReader, sheetname: Optional[str] = None, flags: int = XlsxioReadFlag.SKIP_EMPTY_ROWS, types: Optional[Iterable[type]] = None, default_type: type = str)

Initializet XlsxioReaderSheet object (it object initializes in xlsxioreader.get_sheet and about params you can read there)

def read_row(self, ignore_type: bool = False) -> Optional[list]

Reading next row in list. If rows does not exists return None

  • ignore_type - if this true, return row in default_type (convenient for heading)

def read_header(self) -> Optional[list]

Alias for read_row(True)

def iter_rows(self) -> Iterable[list]

Iterate rows while rows exists

def get_last_row_index(self) -> int:

Getting last row index (returns 0 if not readed yet)

def get_flags(self) -> int:

Getting applied flags

def read_data(self) -> List[list]

Read all sheet rows, and first row in default_type. Method code:

header = self.read_header()
if header is None:
    return []
rows = list(self.iter_rows())
rows.insert(0, header)
return rows

def close(self)

Closes sheet

Metadata

Release files for python-xlsxio 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-xlsxio 0.1.5
File Size Uploaded
python-xlsxio-0.1.5.tar.gz 383.5 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for python-xlsxio 0.1.5
File
python_xlsxio-0.1.5-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
python_xlsxio-0.1.5-cp310-cp310-win32.whl CPython 3.10 CPython 3.10 Windows x86-32 Details
python_xlsxio-0.1.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details
python_xlsxio-0.1.5-cp310-cp310-macosx_10_15_x86_64.whl CPython 3.10 CPython 3.10 macOS 10.15+ x86-64 Details
python_xlsxio-0.1.5-cp39-cp39-win_amd64.whl CPython 3.9 CPython 3.9 Windows x86-64 Details
python_xlsxio-0.1.5-cp39-cp39-win32.whl CPython 3.9 CPython 3.9 Windows x86-32 Details
python_xlsxio-0.1.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.17+ x86-64 Details
python_xlsxio-0.1.5-cp39-cp39-macosx_10_15_x86_64.whl CPython 3.9 CPython 3.9 macOS 10.15+ x86-64 Details
python_xlsxio-0.1.5-cp38-cp38-win_amd64.whl CPython 3.8 CPython 3.8 Windows x86-64 Details
python_xlsxio-0.1.5-cp38-cp38-win32.whl CPython 3.8 CPython 3.8 Windows x86-32 Details
python_xlsxio-0.1.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.8 CPython 3.8 Linux glibc 2.17+ x86-64 Details
python_xlsxio-0.1.5-cp38-cp38-macosx_10_14_x86_64.whl CPython 3.8 CPython 3.8 macOS 10.14+ x86-64 Details
python_xlsxio-0.1.5-cp37-cp37m-win_amd64.whl CPython 3.7 CPython 3.7 pymalloc Windows x86-64 Details
python_xlsxio-0.1.5-cp37-cp37m-win32.whl CPython 3.7 CPython 3.7 pymalloc Windows x86-32 Details
python_xlsxio-0.1.5-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64 Details
python_xlsxio-0.1.5-cp37-cp37m-macosx_10_14_x86_64.whl CPython 3.7 CPython 3.7 pymalloc macOS 10.14+ x86-64 Details

Total release size: 5.3 MB

Release files / python-xlsxio-0.1.5.tar.gz

Download URL python-xlsxio-0.1.5.tar.gz
Size 383.5 kB
Tags Source
SHA-256 checksum
How to use checksums
5f3fb68a426706da3e5cbc72982ee8561ee7703e7234801334d60f0e95ea2687
BLAKE2b-256 checksum
How to use checksums
886425257f830fcf3afd5c228b954c006e61637d52273ba8d2c8d76e20ac9959
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

Release files / python_xlsxio-0.1.5-cp310-cp310-win_amd64.whl

Download URL python_xlsxio-0.1.5-cp310-cp310-win_amd64.whl
Size 169.1 kB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
c733559150d0ec1bd8f778e44117a54fdfdef2f4ac19245fdb43e4353e54c0e8
BLAKE2b-256 checksum
How to use checksums
94b4ad04c16763d1ea8674fcd32a40fed5c8c0cab8c92a2db710bc169af625f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

Release files / python_xlsxio-0.1.5-cp310-cp310-win32.whl

Download URL python_xlsxio-0.1.5-cp310-cp310-win32.whl
Size 143.3 kB
Tags CPython 3.10 Windows x86-32
SHA-256 checksum
How to use checksums
a5e95e52a5aecf47472b2c244e47558ead5ec7b14c49e14b29d637d1de4aace0
BLAKE2b-256 checksum
How to use checksums
fcd11ed58a30961db0a0de275090cdc4a356c053fcf821a6c71c93652f5d9da1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

Release files / python_xlsxio-0.1.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL python_xlsxio-0.1.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 724.8 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
cb78150a3569c9f1fb57bdbe8308f7c49ca6ab6419b9d742d6a47dc0ded23c9c
BLAKE2b-256 checksum
How to use checksums
e8eb3b1018512db334a15f94a76630349f1d0914e3dea3f9a7c7266a80d543fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

Release files / python_xlsxio-0.1.5-cp310-cp310-macosx_10_15_x86_64.whl

Download URL python_xlsxio-0.1.5-cp310-cp310-macosx_10_15_x86_64.whl
Size 194.4 kB
Tags CPython 3.10 macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
df69be5f77f6edd250ff2e6eb0f4b6fb0d87fa9358f5b9ebb56ae069b3019e14
BLAKE2b-256 checksum
How to use checksums
b53d15fc7016483a3d006e519642bf3a6ee9c0feb012fc0bfdc433a88ebabae3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

Release files / python_xlsxio-0.1.5-cp39-cp39-win_amd64.whl

Download URL python_xlsxio-0.1.5-cp39-cp39-win_amd64.whl
Size 168.5 kB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
260e9d0c352fff1c09c91d30882c767f19870a2a8e1dfb4db0fb0c6776bfd23e
BLAKE2b-256 checksum
How to use checksums
f366674c31d3b6e011e593d18160bf2cf728f69f8e44fc1c286d2d67578982ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

Release files / python_xlsxio-0.1.5-cp39-cp39-win32.whl

Download URL python_xlsxio-0.1.5-cp39-cp39-win32.whl
Size 143.2 kB
Tags CPython 3.9 Windows x86-32
SHA-256 checksum
How to use checksums
2f675b56e0faa7e0407e219b05ed475e987c35fd22ed6793cf87114ce5c04f63
BLAKE2b-256 checksum
How to use checksums
6ab49fb4c3519409ee97507cefc2d45c764348fe145209bacbba64783013eba9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

Release files / python_xlsxio-0.1.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL python_xlsxio-0.1.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 723.1 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
9f085b7e5d17e4ebda13dcc76d2cd5f67b8a4b618f52ee0392363b20968f87ab
BLAKE2b-256 checksum
How to use checksums
1a8267565bb6d645309eb81c595f2f5d4514366b1434d221b17adfba9c3e2983
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

Release files / python_xlsxio-0.1.5-cp39-cp39-macosx_10_15_x86_64.whl

Download URL python_xlsxio-0.1.5-cp39-cp39-macosx_10_15_x86_64.whl
Size 194.1 kB
Tags CPython 3.9 macOS 10.15+ x86-64
SHA-256 checksum
How to use checksums
ade1dc79eca0726ca6bef2ccb20d0321a0abd231b6c12710b9f26bd7293600de
BLAKE2b-256 checksum
How to use checksums
faf2afb18b2bc9b8906aa41c7454c23968f2a3ef167eeb44b45a2a557825b470
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

Release files / python_xlsxio-0.1.5-cp38-cp38-win_amd64.whl

Download URL python_xlsxio-0.1.5-cp38-cp38-win_amd64.whl
Size 168.8 kB
Tags CPython 3.8 Windows x86-64
SHA-256 checksum
How to use checksums
8284598b2fe745661843fc451edd458eee717f13c6c2c65ddf6ffdc7d0751f52
BLAKE2b-256 checksum
How to use checksums
0cd33cbe559c1183045df446a83645b47fe9b622f6bb61c92daf6ce9c60c0bac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

Release files / python_xlsxio-0.1.5-cp38-cp38-win32.whl

Download URL python_xlsxio-0.1.5-cp38-cp38-win32.whl
Size 143.4 kB
Tags CPython 3.8 Windows x86-32
SHA-256 checksum
How to use checksums
a5a96d5a9644aeea98aaf5f8c1c5071cd6049a33ac436c15b6834c5f9a0f2b4f
BLAKE2b-256 checksum
How to use checksums
306b343eeca4ecdb25503db34092365389e0aa04098e0974a5ed59f67e308040
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

Release files / python_xlsxio-0.1.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL python_xlsxio-0.1.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 726.9 kB
Tags CPython 3.8 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
5db47f355005a715ef7f9486ec6c55fa755d4f54a7a14c8ce8f6bb4fa2c5f038
BLAKE2b-256 checksum
How to use checksums
3102d65b4770964680fcc1bf88c6f77d5d5764d2c6dc003aa912efcc88c91986
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

Release files / python_xlsxio-0.1.5-cp38-cp38-macosx_10_14_x86_64.whl

Download URL python_xlsxio-0.1.5-cp38-cp38-macosx_10_14_x86_64.whl
Size 194.6 kB
Tags CPython 3.8 macOS 10.14+ x86-64
SHA-256 checksum
How to use checksums
e5b0a28e0abe0684b280d9d794be65d5ebd0ab1893bbe3ce22b5e9673f0e1025
BLAKE2b-256 checksum
How to use checksums
d1146b6069506f5f1d450670fa80c5926898a15044d1ff3f7d28f5deb0795ec8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

Release files / python_xlsxio-0.1.5-cp37-cp37m-win_amd64.whl

Download URL python_xlsxio-0.1.5-cp37-cp37m-win_amd64.whl
Size 168.1 kB
Tags CPython 3.7 CPython 3.7 pymalloc Windows x86-64
SHA-256 checksum
How to use checksums
3dd68e9cbf77dc5981fb56f44ee4f2aac970ae87fb30947636d2193d60653b2f
BLAKE2b-256 checksum
How to use checksums
8cad6b67038c4aee0c0125c942d6cf1481b156ad0f2e9af5bc7bfe1db5372739
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

Release files / python_xlsxio-0.1.5-cp37-cp37m-win32.whl

Download URL python_xlsxio-0.1.5-cp37-cp37m-win32.whl
Size 142.4 kB
Tags CPython 3.7 CPython 3.7 pymalloc Windows x86-32
SHA-256 checksum
How to use checksums
9bda91ab9f21b479632eee6048b48e4d7ee36302ea7be2362489d27905bad650
BLAKE2b-256 checksum
How to use checksums
190943bffbd54e5910cfe17aeb9d9967edbf1d4494aa424f823fee2bd0f3e54f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

Release files / python_xlsxio-0.1.5-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL python_xlsxio-0.1.5-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 703.2 kB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
5e376dbc6bbad2250275c6519f707343923a5c7fa84a7ca84935c8f935ff72ef
BLAKE2b-256 checksum
How to use checksums
891bc300203f8f0f4b671aa268edebef4ba13e0163337a9d07524bf3d6058b7c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12

Release files / python_xlsxio-0.1.5-cp37-cp37m-macosx_10_14_x86_64.whl

Download URL python_xlsxio-0.1.5-cp37-cp37m-macosx_10_14_x86_64.whl
Size 193.9 kB
Tags CPython 3.7 CPython 3.7 pymalloc macOS 10.14+ x86-64
SHA-256 checksum
How to use checksums
feb0317beb62d16bd42375f780dc020ecb232263a8981e97aad090bb7e053391
BLAKE2b-256 checksum
How to use checksums
7a2c1e65f8b22dc2e40b2d4309dd702756ad8b8e3eba9ba547df6d452c39473d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.12
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page