{"id":7646,"library":"pyxlsx","title":"Fast XLSX Reader","description":"Pyxlsx is a fast and memory-efficient Python library designed for reading data from XLSX (Excel) files. It focuses on parsing core data, shared strings, and basic styling, making it suitable for high-performance data extraction. The current stable version is 1.1.3, and releases are typically made for bug fixes and minor improvements as needed.","status":"active","version":"1.1.3","language":"en","source_language":"en","source_url":"https://github.com/fortfall/pyxlsx","tags":["excel","xlsx","parser","reader","spreadsheet","data-extraction"],"install":[{"cmd":"pip install pyxlsx","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Required for efficient parsing of XML components within XLSX files. This is a core dependency.","package":"lxml","optional":false}],"imports":[{"symbol":"Reader","correct":"from pyxlsx import Reader"}],"quickstart":{"code":"import openpyxl\nimport os\nfrom pyxlsx import Reader\n\n# Create a dummy XLSX file for demonstration\nfile_path = \"example.xlsx\"\nworkbook = openpyxl.Workbook()\nsheet = workbook.active\nsheet['A1'] = \"Name\"\nsheet['B1'] = \"Age\"\nsheet['A2'] = \"Alice\"\nsheet['B2'] = 30\nsheet['A3'] = \"Bob\"\nsheet['B3'] = 24\nworkbook.save(file_path)\n\nprint(f\"Created dummy file: {file_path}\")\n\n# Use pyxlsx to read the file\ntry:\n    reader = Reader(file_path)\n    # pyxlsx iterators are one-pass; convert to list if you need to iterate multiple times\n    rows_data = list(reader.rows())\n    \n    if rows_data:\n        print(\"Header row:\", rows_data[0])\n        print(\"Data rows:\")\n        for row in rows_data[1:]:\n            print(row)\n    else:\n        print(\"No data found in the file.\")\n\nexcept FileNotFoundError:\n    print(f\"Error: The file {file_path} was not found. Please ensure it exists.\")\nexcept Exception as e:\n    print(f\"An unexpected error occurred: {e}\")\nfinally:\n    # Clean up the dummy file\n    if os.path.exists(file_path):\n        os.remove(file_path)\n        print(f\"Cleaned up dummy file: {file_path}\")","lang":"python","description":"This quickstart demonstrates how to create a simple XLSX file using `openpyxl` and then read its contents using `pyxlsx`. It shows basic row iteration and includes cleanup."},"warnings":[{"fix":"For writing or full manipulation, consider libraries like `openpyxl` or `xlsxwriter`.","message":"Pyxlsx is a reader-only library. It does not support writing, modifying, or creating XLSX files. Features like macros, charts, and complex formulas are also not parsed.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure `lxml` is installed successfully. On some systems, you might need to install development headers (e.g., `sudo apt-get install libxml2-dev libxslt1-dev` on Debian/Ubuntu, or `brew install libxml2 libxslt` on macOS) before `pip install lxml`.","message":"The `lxml` dependency can sometimes be challenging to install, especially on systems without pre-compiled wheels or proper C compiler setup. It's crucial for `pyxlsx`'s performance.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Inspect output for specific cell types. For dates, consider using `datetime.datetime.fromtimestamp` or similar after parsing if the raw numeric value is returned.","message":"Pyxlsx provides basic parsing of cell values. While it handles basic number and date formatting, complex date/time formats, custom number formats, or cells with errors might be returned as their raw underlying value or require additional post-processing.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Run `pip install lxml` or `pip install pyxlsx` (which should pull `lxml`). If `lxml` installation fails, consult its documentation for system-specific prerequisites.","cause":"The essential `lxml` dependency was not installed correctly or is missing from your environment.","error":"ModuleNotFoundError: No module named 'lxml'"},{"fix":"Verify the file path is absolute or correct relative to your script's execution directory. Double-check the filename and extension.","cause":"The path to the XLSX file provided to `pyxlsx.Reader` is incorrect or the file does not exist at the specified location.","error":"FileNotFoundError: [Errno 2] No such file or directory: 'your_file.xlsx'"},{"fix":"Ensure the `.xlsx` file is valid and can be opened in Excel or another spreadsheet program. Try opening and re-saving the file, or use a different file. `pyxlsx` does not support encrypted files.","cause":"The XLSX file is either corrupted, not a valid XLSX file, or encrypted/password-protected in a way `pyxlsx` cannot handle.","error":"ValueError: Invalid XML: missing required element 'worksheet'"}]}