Registry / serialization / pyxlsb

pyxlsb

JSON →
library1.0.10pypypi✓ verified 27d ago

pyxlsb is a Python library for parsing Excel 2007-2010 Binary Workbook (.xlsb) files. It provides an API to read sheets, rows, and cells, converting various data types like numbers, strings, and dates. The library is actively maintained with a focus on bug fixes and stability, currently at version 1.0.10.

pip install pyxlsb
INSTALL
IMPORT
SIG · PYXLSB
P
pyxlsb
serializationpythonv1.0.10
Install
1.6s avg
Import
65ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.0.10 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.068s · 17.9MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.6s · import 0.062s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

open_workbook
from pyxlsb import open_workbook

Demonstrates how to open an .xlsb file, access its first sheet, and iterate through rows to print cell values. Note that `pyxlsb` is a read-only library, so you'll need an existing `.xlsb` file (e.g., 'example.xlsb') for the code to execute successfully.

import os from pyxlsb import open_workbook # Create a dummy .xlsb file for demonstration if it doesn't exist # In a real scenario, you would have your existing file. # Note: pyxlsb can only read, not write .xlsb files. # A simple way to get one is to create an Excel file and save as 'Excel Binary Workbook (*.xlsb)' # For this example, let's assume 'example.xlsb' exists and has a sheet with data. # If you don't have one, this example will likely fail or print nothing. # For a real application, ensure 'example.xlsb' exists in the current directory # or provide a full path. file_path = os.path.join(os.getcwd(), 'example.xlsb') # Or provide an actual path # You would typically have a real .xlsb file here. # For a runnable example without manual file creation, this part is tricky as pyxlsb is read-only. # For now, we assume a file named 'example.xlsb' exists. try: with open_workbook(file_path) as wb: # Access the first sheet by index (1-based) # Or by name: with wb.get_sheet('Sheet1') as sheet: with wb.get_sheet(1) as sheet: print(f"Reading sheet: {sheet.name}") # Iterate through rows for row_index, row in enumerate(sheet.rows()): if row_index >= 5: # Limit output for quickstart break row_values = [cell.v for cell in row if cell.v is not None] if row_values: print(f"Row {row_index + 1}: {row_values}") except FileNotFoundError: print(f"Warning: '{file_path}' not found. Please create an example.xlsb file to run this quickstart.") except Exception as e: print(f"An error occurred: {e}")
Debug
Known issues
gotchaPrior to version 1.0.10, users might encounter `DeprecationWarning` due to string-byte comparison issues on Python 3.
fix
Upgrade to pyxlsb==1.0.10 or newer to resolve these warnings.
affects: <1.0.10
gotchaVersions before 1.0.8 had known resource leaks. For long-running processes or processing many files, this could lead to memory accumulation or file handle exhaustion.
fix
Upgrade to pyxlsb==1.0.8 or newer. Ensure proper context management (`with open_workbook(...)`) to minimize resource holding.
affects: <1.0.8
gotchaDate and time conversions in versions prior to 1.0.9 could have rounding errors for specific values, leading to slight inaccuracies.
fix
Upgrade to pyxlsb==1.0.9 or newer for improved date/time conversion accuracy.
affects: <1.0.9
gotchaReading worksheets with mixed types (e.g., chart sheets alongside data sheets) could cause issues with sheet selection in versions before 1.0.7.
fix
Upgrade to pyxlsb==1.0.7 or newer. If stuck on an older version, ensure you are selecting data sheets specifically by name if possible.
affects: <1.0.7
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'pyxlsb'
The `pyxlsb` library is not installed in the current Python environment.
fix
pip install pyxlsb
zipfile.BadZipFile: File is not a zip file
The provided file is either corrupted, not a valid .xlsb file, or has an invalid ZIP structure.
fix
Verify the file is a legitimate and uncorrupted .xlsb file. Try opening it manually in Excel to confirm its integrity.
FileNotFoundError: [Errno 2] No such file or directory: 'your_file.xlsb'
The specified .xlsb file does not exist at the given path or the path is incorrect.
fix
Double-check the file path and name, ensuring it is correct and the file exists at that location.
KeyError: 'Sheet1'
The specified sheet name does not exist in the .xlsb workbook or there is a mismatch in case/spelling.
fix
Use `workbook.sheets` to list all available sheet names and ensure the provided name matches exactly (case-sensitive).
Upgrade
Version history
1.0.10latest on PyPI · released Oct 14, 2022
Audit
Dependencies

No dependency data recorded yet.

Agent activity
7 hits · last 30 days
node
6
Resources
pyxlsb — pip install pyxlsb · libregistry