{"record":{"id":"05bad40609534626","repo":"apache/superset","slug":"parsing-error-error-s-05bad4","errorCode":null,"errorMessage":"Parsing error: %(error)s","messagePattern":"Parsing error: (.+?)","errorType":"exception","errorClass":"DatabaseUploadFailed","httpStatus":422,"severity":"error","filePath":"superset/commands/database/uploaders/excel_reader.py","lineNumber":90,"sourceCode":"            \"na_values\": self._options.get(\"null_values\")\n            if self._options.get(\"null_values\")  # None if an empty list\n            else None,\n            \"parse_dates\": self._options.get(\"column_dates\") or False,\n            \"skiprows\": self._options.get(\"skip_rows\", 0),\n            \"sheet_name\": self._options.get(\"sheet_name\", 0),\n            \"nrows\": self._options.get(\"rows_to_read\"),\n        }\n        if self._options.get(\"columns_read\"):\n            kwargs[\"usecols\"] = self._options.get(\"columns_read\")\n        try:\n            return pd.read_excel(**kwargs)\n        except (\n            pd.errors.ParserError,\n            pd.errors.EmptyDataError,\n            UnicodeDecodeError,\n            ValueError,\n        ) as ex:\n            raise DatabaseUploadFailed(\n                message=_(\"Parsing error: %(error)s\", error=str(ex))\n            ) from ex\n        except Exception as ex:\n            raise DatabaseUploadFailed(_(\"Error reading Excel file\")) from ex\n\n    def file_metadata(self, file: FileStorage) -> FileMetadata:\n        try:\n            excel_file = pd.ExcelFile(file)\n        except (ValueError, AssertionError) as ex:\n            raise DatabaseUploadFailed(\n                message=_(\"Excel file format cannot be determined\")\n            ) from ex\n\n        sheet_names = excel_file.sheet_names\n\n        result: FileMetadata = {\"items\": []}\n        for sheet in sheet_names:\n            df = excel_file.parse(sheet, nrows=ROWS_TO_READ_METADATA)","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/apache/superset/blob/f4587218dd19d046c3e4d00063e7d27f8a2ed354/superset/commands/database/uploaders/excel_reader.py#L72-L108","documentation":"DatabaseUploadFailed ('Parsing error: <detail>') raised in ExcelReader._read_sheet_to_dataframe when pd.read_excel fails with pd.errors.ParserError, pd.errors.EmptyDataError, UnicodeDecodeError, or ValueError. Typical messages come from openpyxl/xlrd: 'Worksheet does not exist' (ValueError), empty sheet (EmptyDataError), or invalid cell content failing conversion (ValueError).","triggerScenarios":"Uploading an .xlsx/.xls where the selected sheet name is missing or was renamed; a sheet that is completely empty; specifying usecols (columns_read) with names absent from the sheet; mixed-type columns pandas cannot reconcile (ValueError).","commonSituations":"Users renaming/deleting sheets after the upload dialog listed them; selecting column names that include hidden whitespace; Excel exports with an empty first sheet; very old .xls files requiring xlrd while only openpyxl is installed (surfaces as ValueError about engine/format).","solutions":["Match the embedded pandas message: 'Worksheet does not exist' means the sheet name is wrong — re-pick the sheet","Ensure the chosen sheet has data and a header row consistent with the column list","If columns_read is set, verify names exactly match the sheet's header cells","For .xls (legacy) files, convert to .xlsx or install the xlrd engine dependency"],"exampleFix":"python -c \"import pandas as pd; print(pd.ExcelFile('data.xlsx').sheet_names)\"\n# confirms the exact sheet names to select in the upload dialog","handlingStrategy":"validation","validationCode":"import pandas as pd\n\ndef excel_sheet_ok(path: str, sheet: str, columns: list[str] | None = None) -> bool:\n    xl = pd.ExcelFile(path)\n    if sheet not in xl.sheet_names:\n        return False\n    cols = set(xl.parse(sheet, nrows=1).columns)\n    return columns is None or set(columns) <= cols","typeGuard":null,"tryCatchPattern":"except DatabaseUploadFailed as ex:\n    if 'Worksheet' in str(ex):\n        refresh sheet list and re-select\n    else:\n        report(str(ex))","preventionTips":["Confirm sheet names via pd.ExcelFile(...).sheet_names before upload","Match columns_read names to header cells exactly","Keep legacy .xls out of the flow unless the xlrd engine is installed"],"tags":["excel","pandas","file-upload","parsing"],"backgroundTag":null,"analyzedSha":"f4587218dd19d046c3e4d00063e7d27f8a2ed354","analyzedAt":"2026-08-14T22:39:27.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}