{"record":{"id":"01503a5877f486ed","repo":"pola-rs/polars","slug":"no-data-found-in-the-given-workbook-s-and-sheet-s","errorCode":null,"errorMessage":"no data found in the given workbook(s) and sheet(s)","messagePattern":"no data found in the given workbook\\(s\\) and sheet\\(s\\)","errorType":"exception","errorClass":"NoDataError","httpStatus":null,"severity":"error","filePath":"py-polars/src/polars/io/spreadsheet/functions.py","lineNumber":96,"sourceCode":"                src = str(src)\n            sources.append(src)\n\n    return sources, read_multiple_workbooks\n\n\ndef _standardize_duplicates(s: str) -> str:\n    \"\"\"Standardize columns with '_duplicated_n' names.\"\"\"\n    return re.sub(r\"_duplicated_(\\d+)\", repl=r\"\\1\", string=s)\n\n\ndef _unpack_read_results(\n    frames: list[pl.DataFrame] | list[dict[str, pl.DataFrame]],\n    *,\n    read_multiple_workbooks: bool,\n) -> Any:\n    if not frames:\n        msg = \"no data found in the given workbook(s) and sheet(s)\"\n        raise NoDataError(msg)\n\n    if not read_multiple_workbooks:\n        # one sheet from one workbook\n        return frames[0]\n\n    if isinstance(frames[0], pl.DataFrame):\n        # one sheet from multiple workbooks\n        return concat(frames, how=\"vertical_relaxed\")  # type: ignore[type-var]\n    else:\n        # multiple sheets from multiple workbooks\n        sheet_frames = defaultdict(list)\n        for res in frames:\n            for sheet, df in res.items():  # type: ignore[union-attr]\n                sheet_frames[sheet].append(df)\n        return {k: concat(v, how=\"vertical_relaxed\") for k, v in sheet_frames.items()}\n\n\n@overload","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/py-polars/src/polars/io/spreadsheet/functions.py#L78-L114","documentation":"After parsing all requested workbooks/sheets, read_excel/read_ods raise NoDataError if the result list is empty — no sheet could be read at all. This guards the return-value invariants (it must return a DataFrame or dict of DataFrames).","triggerScenarios":"All requested sheets are empty or unreadable so the parser skipped them; sheet_id/sheet_name filtered out every sheet; or the workbook files contained no usable data.","commonSituations":"Reading truly blank workbooks, sheets whose contents start far below the sampled rows, or requests like sheet_id=[5,6] on a 2-sheet workbook combined with other filtering.","solutions":["Verify the workbook(s) actually contain data on the requested sheet(s) by opening them in Excel/LibreOffice.","Broaden the sheet selection (omit sheet_name/sheet_id, or pass sheet_id=None) to see which sheets parse.","Increase read_options sample rows / adjust has_header if data exists but was skipped during parsing."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"from polars.exceptions import NoDataError\ntry:\n    df = pl.read_excel(src, sheet_name=sheet)\nexcept NoDataError:\n    all_sheets = pl.read_excel(src)  # inspect what is available\n    raise RuntimeError(f'no data; sheets: {list(all_sheets)}') from None","preventionTips":["Open the workbook manually to confirm the sheets hold data","Read all sheets (sheet_id=None) first to discover layout","Check that filters like include_file_paths/sheet selection are not eliminating everything"],"tags":["excel","polars","empty-data","nodataerror"],"backgroundTag":"empty-result-set","analyzedSha":"fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e","analyzedAt":"2026-09-18T22:14:11.667Z","contentChangedAt":"2026-09-18T22:14:11.667Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}