Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Excel 2007-2010 Binary Workbook (xlsb) parser

Project description

PyPI

pyxlsb is an Excel 2007-2010 Binary Workbook (xlsb) parser for Python. The library is currently extremely limited, but functional enough for basic data extraction.

Install

pip install pyxlsb

Usage

The module exposes an open_workbook(name) method (similar to Xlrd and OpenPyXl) for opening XLSB files. The Workbook object representing the file is returned.

from pyxlsb import open_workbook
with open_workbook('Book1.xlsb') as wb:
    # Do stuff with wb

The Workbook object exposes a get_sheet(idx) method for retrieving a Worksheet instance.

# Using the sheet index (1-based)
with wb.get_sheet(1) as sheet:
    # Do stuff with sheet

# Using the sheet name
with wb.get_sheet('Sheet1') as sheet:
    # Do stuff with sheet

Tip: A sheets property containing the sheet names is available on the Workbook instance.

The rows() method will hand out an iterator to read the worksheet rows.

# You can use .rows(sparse=True) to skip empty rows
for row in sheet.rows():
  print(row)
# [Cell(r=0, c=0, v='TEXT'), Cell(r=0, c=1, v=42.1337)]

Do note that dates will appear as floats. You must use the convert_date(date) method from the pyxlsb module to turn them into datetime instances.

from pyxlsb import convert_date
print(convert_date(41235.45578))
# datetime.datetime(2012, 11, 22, 10, 56, 19)

Project details


Download files

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

Files for pyxlsb, version 1.0.5
Filename, size File type Python version Upload date Hashes
Filename, size pyxlsb-1.0.5-py2.py3-none-any.whl (23.6 kB) File type Wheel Python version py2.py3 Upload date Hashes View hashes
Filename, size pyxlsb-1.0.5.tar.gz (21.1 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page