diff --git a/pandas-stubs/io/excel/_base.pyi b/pandas-stubs/io/excel/_base.pyi index f03bdd08b..5b9d5a9c4 100644 --- a/pandas-stubs/io/excel/_base.pyi +++ b/pandas-stubs/io/excel/_base.pyi @@ -245,9 +245,10 @@ class ExcelFile: io: FilePath | ReadBuffer[bytes] | bytes = ... def __init__( self, - io: FilePath | ReadBuffer[bytes] | bytes, + path_or_buffer: FilePath | ReadBuffer[bytes] | bytes, engine: ExcelReadEngine | None = ..., storage_options: StorageOptions = ..., + engine_kwargs: dict[str, Any] | None = ..., ) -> None: ... def __fspath__(self): ... @overload diff --git a/tests/test_io.py b/tests/test_io.py index 682798854..cca219c42 100644 --- a/tests/test_io.py +++ b/tests/test_io.py @@ -1116,6 +1116,14 @@ def test_excel_reader(): check(assert_type(ef, pd.ExcelFile), pd.ExcelFile) check(assert_type(pd.read_excel(ef), pd.DataFrame), pd.DataFrame) + with pd.ExcelFile( + path_or_buffer=path, + engine="openpyxl", + engine_kwargs={"data_only": True}, + ) as ef: + check(assert_type(ef, pd.ExcelFile), pd.ExcelFile) + check(assert_type(pd.read_excel(ef), pd.DataFrame), pd.DataFrame) + def test_excel_writer(): with ensure_clean(".xlsx") as path: