{"record":{"id":"e428def1415dd7dc","repo":"MiniMax-AI/skills","slug":"xls-is-a-legacy-binary-format-not-supported-by-th","errorCode":null,"errorMessage":".xls is a legacy binary format not supported by this tool. Please open the file in Excel and save as .xlsx, then retry.","messagePattern":"\\.xls is a legacy binary format not supported by this tool\\. Please open the file in Excel and save as \\.xlsx, then retry\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"warning","filePath":"skills/minimax-xlsx/scripts/xlsx_reader.py","lineNumber":78,"sourceCode":"        sep = \"\\t\" if suffix == \".tsv\" else \",\"\n        encodings = [\"utf-8-sig\", \"gbk\", \"utf-8\", \"latin-1\"]\n        last_error = None\n        for enc in encodings:\n            try:\n                import pandas as pd\n                df = pd.read_csv(file_path, sep=sep, encoding=enc)\n                df._reader_encoding = enc  # attach metadata (non-standard, for reporting)\n                return {path.stem: df}\n            except (UnicodeDecodeError, Exception) as e:\n                last_error = e\n                continue\n        raise ValueError(\n            f\"Cannot decode {file_path}. Tried encodings: {encodings}. \"\n            f\"Last error: {last_error}\"\n        )\n\n    elif suffix == \".xls\":\n        raise ValueError(\n            \".xls is a legacy binary format not supported by this tool. \"\n            \"Please open the file in Excel and save as .xlsx, then retry.\"\n        )\n\n    else:\n        raise ValueError(\n            f\"Unsupported file format: {suffix}. \"\n            \"Supported formats: .xlsx, .xlsm, .csv, .tsv\"\n        )\n\n\n# ---------------------------------------------------------------------------\n# Structure discovery\n# ---------------------------------------------------------------------------\n\ndef explore_structure(sheets: dict) -> dict:\n    \"\"\"\n    Return a structured dict describing each sheet.","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/MiniMax-AI/skills/blob/60aaae52bb2af8162732751a4332f62a5fef518b/skills/minimax-xlsx/scripts/xlsx_reader.py#L60-L96","documentation":"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.","triggerScenarios":"Passing a legacy .xls (Excel 97-2003) binary file to detect_and_load().","commonSituations":"Old exported reports; third-party/ERP systems still emitting .xls; user downloads a template that defaults to .xls.","solutions":["Open in Excel/LibreOffice and Save As .xlsx.","Convert headlessly: libreoffice --headless --convert-to xlsx file.xls","Or: pip install xlrd==1.2.0 and read with pd.read_excel(engine='xlrd') in your own code."],"exampleFix":"# before\npython3 xlsx_reader.py report.xls   # ValueError: .xls legacy format not supported\n\n# after\nlibreoffice --headless --convert-to xlsx report.xls\npython3 xlsx_reader.py report.xlsx","handlingStrategy":"fallback","validationCode":"from pathlib import Path\nif Path(file_path).suffix.lower() == '.xls':\n    # auto-convert to xlsx before loading\n    import subprocess\n    subprocess.run(['libreoffice','--headless','--convert-to','xlsx',file_path], check=True)\n    file_path = str(Path(file_path).with_suffix('.xlsx'))","typeGuard":"def is_supported_excel(p) -> bool:\n    return Path(p).suffix.lower() in ('.xlsx', '.xlsm')","tryCatchPattern":"try:\n    sheets = detect_and_load(file_path)\nexcept ValueError as e:\n    if '.xls' in str(e) and 'legacy' in str(e):\n        subprocess.run(['libreoffice','--headless','--convert-to','xlsx',file_path], check=True)\n        sheets = detect_and_load(str(Path(file_path).with_suffix('.xlsx')))\n    else:\n        raise","preventionTips":["Standardize exports on .xlsx at the source system.","Provide a headless LibreOffice conversion step for legacy .xls.","Document the .xls limitation upstream of users."],"tags":["file-format","excel","xls","pandas"],"backgroundTag":null,"analyzedSha":"60aaae52bb2af8162732751a4332f62a5fef518b","analyzedAt":"2026-08-13T17:32:34.717Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}