{"id":3754,"library":"pyexcel-xlsx","title":"pyexcel-xlsx: XLSX/XLSM Handler for pyexcel","description":"pyexcel-xlsx is a wrapper library designed to read, manipulate, and write data in XLSX and XLSM formats by leveraging `openpyxl`. It functions as a plugin for the `pyexcel` ecosystem, offering a unified API for handling various Excel file types. The library is actively maintained with regular updates and bug fixes.","status":"active","version":"0.6.1","language":"en","source_language":"en","source_url":"https://github.com/pyexcel/pyexcel-xlsx","tags":["excel","xlsx","xlsm","data processing","pyexcel","openpyxl"],"install":[{"cmd":"pip install pyexcel-xlsx","lang":"bash","label":"Install pyexcel-xlsx"}],"dependencies":[{"reason":"Core framework that pyexcel-xlsx extends as a plugin for unified Excel operations.","package":"pyexcel"},{"reason":"Base library providing the plugin interface and I/O operations for pyexcel. Required version >= 0.6.2 for compatibility with new style plugins.","package":"pyexcel-io"},{"reason":"Underlying library used by pyexcel-xlsx to handle XLSX/XLSM file formats.","package":"openpyxl"}],"imports":[{"note":"For standalone usage of pyexcel-xlsx without the pyexcel unified API.","symbol":"get_data","correct":"from pyexcel_xlsx import get_data"},{"note":"For standalone usage of pyexcel-xlsx without the pyexcel unified API.","symbol":"save_data","correct":"from pyexcel_xlsx import save_data"},{"note":"Since pyexcel version 0.2.2, pyexcel-xlsx is auto-loaded when pyexcel is installed. Explicit import of pyexcel_xlsx is not needed when using pyexcel's unified API (e.g., pe.get_sheet(), pe.save_as()).","wrong":"import pyexcel_xlsx","symbol":"pyexcel","correct":"import pyexcel as pe"}],"quickstart":{"code":"import pyexcel as pe\nfrom collections import OrderedDict\nimport os\n\n# Create some data for an Excel sheet\ndata = OrderedDict()\ndata.update({\"Sheet 1\": [[1, 2, 3], [4, 5, 6]]})\ndata.update({\"Sheet 2\": [[\"A\", \"B\", \"C\"], [7, 8, 9]]})\n\nfile_name = \"my_excel_file.xlsx\"\n\n# Save data to an XLSX file using pyexcel's unified API\npe.save_as(adict=data, dest_file_name=file_name)\nprint(f\"Data successfully saved to {file_name}\")\n\n# Read data from the XLSX file\nbook = pe.get_book(file_name=file_name)\n\nprint(f\"\\nData read from {file_name}:\")\nfor sheet_name in book.sheet_names():\n    sheet = book.sheet_by_name(sheet_name)\n    print(f\"Sheet Name: {sheet_name}\")\n    for row in sheet:\n        print(row)\n\n# Clean up the created file\nos.remove(file_name)\nprint(f\"\\nCleaned up {file_name}\")","lang":"python","description":"This quickstart demonstrates how to write an `OrderedDict` to an XLSX file and then read it back using `pyexcel`'s unified API, which automatically utilizes `pyexcel-xlsx` for the XLSX format. It covers both saving and retrieving data from multi-sheet Excel files."},"warnings":[{"fix":"Ensure your project uses Python 3.6 or newer. If upgrading from pre-0.6.0, review `pyexcel-io` documentation for changes to the plugin interface or upgrade all `pyexcel` related packages to their latest versions.","message":"Version 0.6.0 dropped support for Python versions lower than 3.6. Additionally, it introduced 'new style plugins' aligned with pyexcel-io v0.6.2+, which means older `pyexcel-io` plugins are incompatible with this version.","severity":"breaking","affected_versions":"0.6.0 and higher"},{"fix":"Rely on `import pyexcel as pe` and use `pe.get_sheet()` or `pe.save_as()`. Only use `from pyexcel_xlsx import get_data, save_data` if you intend to use `pyexcel-xlsx` as a standalone library without `pyexcel`'s unified workflow.","message":"When using `pyexcel` as the main interface (e.g., `pyexcel.get_sheet()` or `pyexcel.save_as()`), `pyexcel-xlsx` is auto-loaded. Explicitly importing `pyexcel_xlsx` is generally not needed and can lead to confusion if standalone functions are used alongside the unified API.","severity":"gotcha","affected_versions":"All versions since pyexcel 0.2.2"},{"fix":"If advanced formatting or chart manipulation is required, consider using `openpyxl` directly or other specialized libraries.","message":"The library primarily focuses on data processing. Features like fonts, colors, charts, or other styling elements within XLSX/XLSM files are not supported.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure that any XLSX/XLSM files you intend to process with `pyexcel-xlsx` are not password-protected.","message":"pyexcel-xlsx does not support reading or writing password-protected XLSX/XLSM files.","severity":"gotcha","affected_versions":"All versions"},{"fix":"No action required, as integer detection is handled automatically. If you encounter issues with integer detection, it's likely an `openpyxl` behavior rather than `pyexcel-xlsx`.","message":"The `auto_detect_int` flag, commonly found in other Excel libraries, has no effect when using `pyexcel-xlsx`. This is because `openpyxl`, its underlying dependency, detects integers by default in Python 3.","severity":"gotcha","affected_versions":"All Python 3 compatible versions"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}