{"record":{"id":"736029358d73b0d0","repo":"pola-rs/polars","slug":"table-named-table-name-r-not-found-in-sheet-she-736029","errorCode":null,"errorMessage":"table named {table_name!r} not found in sheet {sheet_name!r} / else / no named tables found in sheet {sheet_name!r} (looking for {table_name!r})","messagePattern":"table named (.+?) not found in sheet (.+?) / else / no named tables found in sheet (.+?) \\(looking for (.+?)\\)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/io/spreadsheet/functions.py","lineNumber":1222,"sourceCode":"    has_header = read_options.pop(\"has_header\", True)\n    schema_overrides = schema_overrides or {}\n    no_inference = infer_schema_length == 0\n    header: list[str | None] = []\n\n    if table_name and not sheet_name:\n        ws, sheet_name, n_tables = None, None, 0\n        for sheet in parser.worksheets:\n            n_tables += 1\n            if table_name in sheet.tables:\n                ws, sheet_name = sheet, sheet.title\n                break\n        if ws is None:\n            msg = (\n                f\"table named {table_name!r} not found in sheet {sheet_name!r}\"\n                if n_tables\n                else f\"no named tables found in sheet {sheet_name!r} (looking for {table_name!r})\"\n            )\n            raise RuntimeError(msg)\n    else:\n        ws = parser[sheet_name]\n\n    # prefer detection of actual table objects; otherwise read\n    # data in the used worksheet range, dropping null columns\n    if tables := getattr(ws, \"tables\", None):\n        table = tables[table_name] if table_name else next(iter(tables.values()))\n        rows = list(ws[table.ref])\n        if not rows:\n            return _empty_frame(raise_if_empty)\n        if has_header:\n            header.extend(cell.value for cell in rows.pop(0))\n        else:\n            header.extend(f\"column_{n}\" for n in range(len(rows[0])))\n        if table.totalsRowCount:\n            rows = rows[: -table.totalsRowCount]\n        rows_iter = rows\n    elif table_name:","sourceCodeStart":1204,"sourceCodeEnd":1240,"githubUrl":"https://github.com/pola-rs/polars/blob/5d8ebabf11caea54a5c29178a64a058762f49766/py-polars/src/polars/io/spreadsheet/functions.py#L1204-L1240","documentation":"Raised by the openpyxl reader when `table_name` is given without `sheet_name` and the named table cannot be located in any worksheet. The message distinguishes between no tables existing at all and the specific table being absent.","triggerScenarios":"Thrown at py-polars/src/polars/io/spreadsheet/functions.py:1219 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Confirm the named table exists in the target sheet; correct table_name or sheet_name."],"exampleFix":null,"handlingStrategy":"validation","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-14T00:17:10.932Z"}