{"id":1687,"library":"pyxlsb","title":"pyxlsb: Excel Binary Workbook (.xlsb) Parser","description":"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.","status":"active","version":"1.0.10","language":"en","source_language":"en","source_url":"https://github.com/willtrnr/pyxlsb","tags":["excel","xlsb","parser","binary","workbook","data-processing"],"install":[{"cmd":"pip install pyxlsb","lang":"bash","label":"Install stable release"}],"dependencies":[],"imports":[{"symbol":"open_workbook","correct":"from pyxlsb import open_workbook"}],"quickstart":{"code":"import os\nfrom pyxlsb import open_workbook\n\n# Create a dummy .xlsb file for demonstration if it doesn't exist\n# In a real scenario, you would have your existing file.\n# Note: pyxlsb can only read, not write .xlsb files.\n# A simple way to get one is to create an Excel file and save as 'Excel Binary Workbook (*.xlsb)'\n# For this example, let's assume 'example.xlsb' exists and has a sheet with data.\n# If you don't have one, this example will likely fail or print nothing.\n\n# For a real application, ensure 'example.xlsb' exists in the current directory\n# or provide a full path.\n\nfile_path = os.path.join(os.getcwd(), 'example.xlsb') # Or provide an actual path\n# You would typically have a real .xlsb file here.\n# For a runnable example without manual file creation, this part is tricky as pyxlsb is read-only.\n# For now, we assume a file named 'example.xlsb' exists.\n\ntry:\n    with open_workbook(file_path) as wb:\n        # Access the first sheet by index (1-based)\n        # Or by name: with wb.get_sheet('Sheet1') as sheet:\n        with wb.get_sheet(1) as sheet:\n            print(f\"Reading sheet: {sheet.name}\")\n            # Iterate through rows\n            for row_index, row in enumerate(sheet.rows()):\n                if row_index >= 5: # Limit output for quickstart\n                    break\n                row_values = [cell.v for cell in row if cell.v is not None]\n                if row_values:\n                    print(f\"Row {row_index + 1}: {row_values}\")\nexcept FileNotFoundError:\n    print(f\"Warning: '{file_path}' not found. Please create an example.xlsb file to run this quickstart.\")\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")","lang":"python","description":"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."},"warnings":[{"fix":"Upgrade to pyxlsb==1.0.10 or newer to resolve these warnings.","message":"Prior to version 1.0.10, users might encounter `DeprecationWarning` due to string-byte comparison issues on Python 3.","severity":"gotcha","affected_versions":"<1.0.10"},{"fix":"Upgrade to pyxlsb==1.0.8 or newer. Ensure proper context management (`with open_workbook(...)`) to minimize resource holding.","message":"Versions 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.","severity":"gotcha","affected_versions":"<1.0.8"},{"fix":"Upgrade to pyxlsb==1.0.9 or newer for improved date/time conversion accuracy.","message":"Date and time conversions in versions prior to 1.0.9 could have rounding errors for specific values, leading to slight inaccuracies.","severity":"gotcha","affected_versions":"<1.0.9"},{"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.","message":"Reading worksheets with mixed types (e.g., chart sheets alongside data sheets) could cause issues with sheet selection in versions before 1.0.7.","severity":"gotcha","affected_versions":"<1.0.7"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}