{"record":{"id":"d6725c73df878e66","repo":"pola-rs/polars","slug":"source","errorCode":null,"errorMessage":"{source}","messagePattern":"\\{source\\}","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/io/spreadsheet/functions.py","lineNumber":842,"sourceCode":"                if (sheet_id == 0 or ws[\"index\"] in ids or ws[\"name\"] in names)\n            }\n            for idx in ids:\n                if (name := sheet_names_by_idx.get(idx)) is None:\n                    msg = f\"no matching sheet found when `sheet_id` is {idx}\"\n                    raise ValueError(msg)\n                sheet_names.append(name)\n\n    return sheet_names, return_multiple_sheets  # type: ignore[return-value]\n\n\ndef _initialise_spreadsheet_parser(\n    engine: str | None,\n    source: str | IO[bytes] | bytes,\n    engine_options: dict[str, Any],\n) -> tuple[Callable[..., pl.DataFrame], Any, list[dict[str, Any]]]:\n    \"\"\"Instantiate the indicated spreadsheet parser and establish related properties.\"\"\"\n    if isinstance(source, str) and not Path(source).exists():\n        raise FileNotFoundError(source)\n\n    if engine == \"xlsx2csv\":  # default\n        xlsx2csv = import_optional(\"xlsx2csv\")\n\n        # establish sensible defaults for unset options\n        for option, value in {\n            \"exclude_hidden_sheets\": False,\n            \"skip_empty_lines\": False,\n            \"skip_hidden_rows\": False,\n            \"floatformat\": \"%f\",\n        }.items():\n            engine_options.setdefault(option, value)\n\n        if isinstance(source, bytes):\n            source = BytesIO(source)\n\n        parser = xlsx2csv.Xlsx2csv(source, **engine_options)\n        sheets = parser.workbook.sheets","sourceCodeStart":824,"sourceCodeEnd":860,"githubUrl":"https://github.com/pola-rs/polars/blob/5d8ebabf11caea54a5c29178a64a058762f49766/py-polars/src/polars/io/spreadsheet/functions.py#L824-L860","documentation":"Generic passthrough raised by `_initialise_spreadsheet_parser` when the underlying engine fails to initialize (e.g. corrupt/unreadable workbook file); the message is simply the stringified source error.","triggerScenarios":"Thrown at py-polars/src/polars/io/spreadsheet/functions.py:837 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the spreadsheet source exists and is readable; check the path or file object passed."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5d8ebabf11caea54a5c29178a64a058762f49766","analyzedAt":"2026-08-19T12:15:06.350Z","contentChangedAt":"2026-08-19T12:15:06.350Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}