Skip to content

DOC: #25723 passing kwargs to excel document engine #26465

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

Merged
merged 4 commits into from
May 20, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions doc/source/user_guide/io.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2864,6 +2864,16 @@ of sheet names can simply be passed to ``read_excel`` with no loss in performanc
data = pd.read_excel('path_to_file.xls', ['Sheet1', 'Sheet2'],
index_col=None, na_values=['NA'])

If control is needed over how a file is read, an ``xlrd`` workbook
created with the desired keyword arguments can be passed to ``ExcelFile``.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be it's just me, but I don't find this sentence very easy to read.

I'd rephrase to something like: "pandas.ExcelFile can also be called with an xlrd.open_workbook as a parameter. This lets the user have control on how the workbook is opened, for example with on_demand=True". Or something similar.

CC: @WillAyd @TomAugspurger

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@datapythonista's sounds good, though I might change "an xldd.open_workbook" to whatever type of object that returns.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. I just committed the suggested changes.


.. code-block:: python

xlrd_book = xlrd.open_workbook('path_to_file.xls', on_demand=True)
with pd.ExcelFile(xlrd_book) as xls:
df1 = pd.read_excel(xls, 'Sheet1')
df2 = pd.read_excel(xls, 'Sheet2')

.. _io.excel.specifying_sheets:

Specifying Sheets
Expand Down