-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ENH: Allow passing read_only
, data_only
and keep_links
arguments to openpyxl using engine_kwargs
#55807
Conversation
# GH 55027 | ||
# test that `read_only` and `data_only` can be passed to | ||
# `openpyxl.reader.excel.load_workbook` via `engine_kwargs` | ||
from pandas.io.excel._openpyxl import OpenpyxlReader |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you import this at the top of the file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. Done.
…s to openpyxl using `engine_kwargs` Previously it was not possible to override the default values for `openpyxl.reader.excel.load_workbook`'s `read_only`, `data_only` and `keep_links` arguments (see pandas-dev#55027). Now these options can be changed via `engine_kwargs`. Closes pandas-dev#55027
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a solid improvement over the current implementation, but it is still odd in relation to the other readers. I believe openpyxl is the only reader where we pass non-default values to the load function of the engine. Still, the values we pass seem like they would be the preferred values in most cases to me. Perhaps it's sufficient to document this oddity?
Thanks for your feedback. I don't find it particularly odd that pandas passes non-default arguments to openpyxl. I think these tools just have somewhat different use cases in mind. Openpyxl seems to focus on modifying excel files, so it makes sense that by default they open files with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm; @mroeschke - you good here?
Thanks @dweindl |
Previously it was not possible to override the default values for
openpyxl.reader.excel.load_workbook
'sread_only
,data_only
andkeep_links
arguments viapandas.read_excel
'sengine_kwargs
(see #55027).Now these options can be changed via
engine_kwargs
.doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.