{"id":15063,"library":"xls2xlsx","title":"XLS to XLSX File Converter","description":"xls2xlsx is a Python library designed to convert older Microsoft Excel .xls files into the newer .xlsx format. It provides a simple API for file conversion, leveraging xlrd for reading .xls and openpyxl for writing .xlsx. The current version is 0.2.0. While stable, its development appears to be in maintenance mode since its last update in 2021, with no active releases or new features planned.","status":"maintenance","version":"0.2.0","language":"en","source_language":"en","source_url":"https://github.com/snoopyjc/xls2xlsx","tags":["excel","xls","xlsx","file conversion","office"],"install":[{"cmd":"pip install xls2xlsx","lang":"bash","label":"Install xls2xlsx"}],"dependencies":[{"reason":"Required for reading .xls files. Note critical compatibility warning regarding xlrd versions >= 2.0.0.","package":"xlrd"},{"reason":"Required for writing .xlsx files.","package":"openpyxl"}],"imports":[{"symbol":"XLS2XLSX","correct":"from xls2xlsx import XLS2XLSX"}],"quickstart":{"code":"import os\nfrom xls2xlsx import XLS2XLSX\n\ninput_file = \"temp_input.xls\"\noutput_file = \"temp_output.xlsx\"\n\n# --- Create a dummy .xls file for demonstration ---\n# This part requires 'xlwt' to be installed (pip install xlwt).\n# If xlwt is not installed, the example will print an error\n# and not proceed with the conversion.\ntry:\n    import xlwt\n    workbook = xlwt.Workbook()\n    sheet = workbook.add_sheet(\"Sheet1\")\n    sheet.write(0, 0, \"Hello\")\n    sheet.write(0, 1, \"World\")\n    sheet.write(1, 0, 123)\n    sheet.write(1, 1, 456)\n    workbook.save(input_file)\n    print(f\"Created dummy input file: {input_file}\")\nexcept ImportError:\n    print(\"Error: 'xlwt' library not found. Please install it (pip install xlwt) to run this quickstart, or create 'temp_input.xls' manually.\")\n    exit(1) # Exit if we cannot create the prerequisite file\n\n# --- Perform the conversion ---\ntry:\n    print(f\"Converting '{input_file}' to '{output_file}'...\")\n    x2x = XLS2XLSX(input_file)\n    x2x.to_xlsx(output_file)\n    print(f\"Conversion complete. Output saved to '{output_file}'.\")\n\n    # --- Optional: Verify the output (requires openpyxl, a core dependency) ---\n    import openpyxl\n    wb_xlsx = openpyxl.load_workbook(output_file)\n    sheet_xlsx = wb_xlsx.active\n    print(f\"Verifying content: A1='{sheet_xlsx['A1'].value}', B1='{sheet_xlsx['B1'].value}'\")\n    assert sheet_xlsx['A1'].value == \"Hello\"\n    assert sheet_xlsx['B1'].value == \"World\"\n    print(\"Verification successful.\")\n\nexcept FileNotFoundError:\n    print(f\"Error: Input file '{input_file}' not found. Please ensure it exists.\")\nexcept Exception as e:\n    print(f\"An error occurred during conversion: {e}\")\nfinally:\n    # --- Clean up dummy files ---\n    print(\"Cleaning up temporary files...\")\n    if os.path.exists(input_file):\n        os.remove(input_file)\n    if os.path.exists(output_file):\n        os.remove(output_file)\n    print(\"Cleanup complete.\")\n","lang":"python","description":"This quickstart demonstrates how to convert an `.xls` file to `.xlsx`. It first creates a dummy `.xls` file using `xlwt` (which needs to be installed separately via `pip install xlwt` to make the example runnable out-of-the-box) and then performs the conversion, verifying the output before cleaning up the temporary files."},"warnings":[{"fix":"Ensure `xlrd` is downgraded to a version less than 2.0.0, e.g., by running `pip install \"xlrd<2.0.0\"`.","message":"Critical: `xlrd` Version Compatibility for .xls support. `xls2xlsx` relies on `xlrd` to read `.xls` files. `xlrd` versions 2.0.0 and above intentionally removed support for `.xls` files by default to focus on `.xlsx`. If `xlrd>=2.0.0` is installed in your environment, `xls2xlsx` will fail to open `.xls` files, even though `xls2xlsx`'s `setup.py` allows it. This is a common footgun for users who install the latest `xlrd`.","severity":"breaking","affected_versions":"xls2xlsx 0.1.0 to 0.2.0 when used with `xlrd>=2.0.0`."},{"fix":"For extremely large files, consider processing in chunks if possible (though `xls2xlsx` does not directly support this), or use alternative tools designed for streaming large datasets. Ensure sufficient RAM is available for conversion.","message":"Performance and Memory Usage for Large Files. Converting very large `.xls` files can be memory-intensive. `xlrd` typically loads the entire workbook into memory, which can lead to high RAM consumption and slow performance for multi-megabyte or gigabyte files.","severity":"gotcha","affected_versions":"All versions of `xls2xlsx`."},{"fix":"Manually inspect converted `.xlsx` files for fidelity, especially for spreadsheets containing advanced features. Be prepared to recreate complex elements in the `.xlsx` file if necessary.","message":"Feature Loss (Macros, Charts, Complex Formatting). The `.xls` to `.xlsx` conversion primarily focuses on data and basic formatting. Complex features such as VBA macros, charts, embedded objects, custom views, and certain advanced cell styles or formulas may not be fully preserved or may be lost during the conversion.","severity":"gotcha","affected_versions":"All versions of `xls2xlsx`."},{"fix":"For critical long-term projects, evaluate the stability and current features carefully. If new features or active maintenance are required, consider alternative libraries or be prepared to maintain a fork.","message":"Library Maintenance Status. The `xls2xlsx` library appears to be in maintenance mode, with its last release (0.2.0) in March 2021. This indicates that new features, performance improvements, or prompt bug/security fixes are unlikely. Users should be aware that the project is not actively developed.","severity":"gotcha","affected_versions":"All versions (0.1.0-0.2.0)."}],"env_vars":null,"last_verified":"2026-04-15T00:00:00.000Z","next_check":"2026-07-14T00:00:00.000Z","problems":[],"ecosystem":"pypi"}