Skip to content

fix(excel): report missing frictionless[excel] instead of invalid excel file - #1802

Open
Sanjays2402 wants to merge 1 commit into
frictionlessdata:mainfrom
Sanjays2402:fix/xlsx-missing-extra-dependency
Open

fix(excel): report missing frictionless[excel] instead of invalid excel file#1802
Sanjays2402 wants to merge 1 commit into
frictionlessdata:mainfrom
Sanjays2402:fix/xlsx-missing-extra-dependency

Conversation

@Sanjays2402

Copy link
Copy Markdown

The xlsx parser resolved platform.openpyxl inside the try/except around load_workbook, so when frictionless[excel] is not installed the @extras install hint was swallowed and re-raised as invalid excel file "table.xlsx". Resolving the attribute before the try block lets the hint propagate while genuine parse failures still map to a format error.

The regression test forces the import to fail via sys.modules, so it exercises the missing-dependency path even in CI where openpyxl is installed; it fails on the unpatched parser with the invalid excel file note and passes with the fix.

This change was prepared with AI assistance; the regression test was run locally and fails without the fix.

…el file

The xlsx parser resolved platform.openpyxl inside the try/except that wraps
load_workbook. When the excel extra is not installed, the FrictionlessException
raised by the @Extras decorator was caught there and replaced with a
misleading 'invalid excel file' format error, so users had no indication that
a dependency was missing.

The attribute is now resolved before the try block, so the install hint
propagates unchanged while genuine parsing failures still map to a
format error.

Adds a regression test that forces the import to fail via sys.modules so it
exercises the missing-dependency path even in a fully installed environment.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

wrong error message when frictionless[excel] is not installed

1 participant