MiniMax-AI/skills · warning · ValueError

.xls is a legacy binary format not supported by this tool. P

Error message

.xls is a legacy binary format not supported by this tool. Please open the file in Excel and save as .xlsx, then retry.

What it means

Files with a .xls suffix are explicitly rejected because pandas/openpyxl handle only the XML-based .xlsx/.xlsm. The legacy binary OLE format (Excel 97-2003) needs the deprecated xlrd engine, which the script deliberately avoids; it asks the user to resave as .xlsx instead.

Source

Thrown at skills/minimax-xlsx/scripts/xlsx_reader.py:78

        sep = "\t" if suffix == ".tsv" else ","
        encodings = ["utf-8-sig", "gbk", "utf-8", "latin-1"]
        last_error = None
        for enc in encodings:
            try:
                import pandas as pd
                df = pd.read_csv(file_path, sep=sep, encoding=enc)
                df._reader_encoding = enc  # attach metadata (non-standard, for reporting)
                return {path.stem: df}
            except (UnicodeDecodeError, Exception) as e:
                last_error = e
                continue
        raise ValueError(
            f"Cannot decode {file_path}. Tried encodings: {encodings}. "
            f"Last error: {last_error}"
        )

    elif suffix == ".xls":
        raise ValueError(
            ".xls is a legacy binary format not supported by this tool. "
            "Please open the file in Excel and save as .xlsx, then retry."
        )

    else:
        raise ValueError(
            f"Unsupported file format: {suffix}. "
            "Supported formats: .xlsx, .xlsm, .csv, .tsv"
        )


# ---------------------------------------------------------------------------
# Structure discovery
# ---------------------------------------------------------------------------

def explore_structure(sheets: dict) -> dict:
    """
    Return a structured dict describing each sheet.

View on GitHub (pinned to 60aaae52bb)

Solutions

  1. Open in Excel/LibreOffice and Save As .xlsx.
  2. Convert headlessly: libreoffice --headless --convert-to xlsx file.xls
  3. Or: pip install xlrd==1.2.0 and read with pd.read_excel(engine='xlrd') in your own code.

Example fix

# before
python3 xlsx_reader.py report.xls   # ValueError: .xls legacy format not supported

# after
libreoffice --headless --convert-to xlsx report.xls
python3 xlsx_reader.py report.xlsx
Defensive patterns

Strategy: fallback

Validate before calling

from pathlib import Path
if Path(file_path).suffix.lower() == '.xls':
    # auto-convert to xlsx before loading
    import subprocess
    subprocess.run(['libreoffice','--headless','--convert-to','xlsx',file_path], check=True)
    file_path = str(Path(file_path).with_suffix('.xlsx'))

Type guard

def is_supported_excel(p) -> bool:
    return Path(p).suffix.lower() in ('.xlsx', '.xlsm')

Try / catch

try:
    sheets = detect_and_load(file_path)
except ValueError as e:
    if '.xls' in str(e) and 'legacy' in str(e):
        subprocess.run(['libreoffice','--headless','--convert-to','xlsx',file_path], check=True)
        sheets = detect_and_load(str(Path(file_path).with_suffix('.xlsx')))
    else:
        raise

Prevention

When it happens

Trigger: Passing a legacy .xls (Excel 97-2003) binary file to detect_and_load().

Common situations: Old exported reports; third-party/ERP systems still emitting .xls; user downloads a template that defaults to .xls.

Related errors


AI-assisted analysis of MiniMax-AI/skills@60aaae52bb (2026-08-13). Data as JSON: /api/errors/e428def1415dd7dc. Report an issue: GitHub.