ENH: Raise error for 'sheet' arg in read_excel
State: closed

- [ ] closes #17994 

I was also thinking about the possibility of raising a warning instead, and do something like:

```
if sheet in kwds:
    sheet_name = sheet
```

Labels:
name: Error Reporting
description: Incorrect or improved errors from pandas
name: IO Excel
description: read_excel, to_excel

Comments:
Hello @lucianoviola! Thanks for updating the PR.





Cheers ! There are no PEP8 issues in this Pull Request. :beers: 

##### Comment last updated on July 07, 2018 at 16:23 Hours UTC
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/18604?src=pr&el=h1) Report
> Merging [#18604](https://codecov.io/gh/pandas-dev/pandas/pull/18604?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/0e168188811677f9de72a6a5b97253e551b6b04a?src=pr&el=desc) will **decrease** coverage by `0.01%`.
> The diff coverage is `50%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/18604/graphs/tree.svg?width=650&height=150&src=pr&token=eZ4WkYLtcO)](https://codecov.io/gh/pandas-dev/pandas/pull/18604?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #18604      +/-   ##
==========================================
- Coverage   91.46%   91.45%   -0.02%     
==========================================
  Files         157      157              
  Lines       51439    51441       +2     
==========================================
- Hits        47051    47043       -8     
- Misses       4388     4398      +10
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.32% <50%> (-0.01%)` | :arrow_down: |
| #single | `40.6% <0%> (-0.11%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/18604?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/excel.py](https://codecov.io/gh/pandas-dev/pandas/pull/18604/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2V4Y2VsLnB5) | `80.3% <50%> (-0.09%)` | :arrow_down: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/18604/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/18604/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.81% <0%> (-0.1%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/18604?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/18604?src=pr&el=footer). Last update [0e16818...1e6b21a](https://codecov.io/gh/pandas-dev/pandas/pull/18604?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/18604?src=pr&el=h1) Report
> Merging [#18604](https://codecov.io/gh/pandas-dev/pandas/pull/18604?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/e84cf2ad20601dc2da58390f36eb96ca0c902bee?src=pr&el=desc) will **decrease** coverage by `0.5%`.
> The diff coverage is `50%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/18604/graphs/tree.svg?width=650&height=150&src=pr&token=eZ4WkYLtcO)](https://codecov.io/gh/pandas-dev/pandas/pull/18604?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #18604      +/-   ##
==========================================
- Coverage   91.95%   91.45%   -0.51%     
==========================================
  Files         160      157       -3     
  Lines       49837    51441    +1604     
==========================================
+ Hits        45830    47043    +1213     
- Misses       4007     4398     +391
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.32% <50%> (-1.02%)` | :arrow_down: |
| #single | `40.6% <0%> (-1.48%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/18604?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/excel.py](https://codecov.io/gh/pandas-dev/pandas/pull/18604/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2V4Y2VsLnB5) | `80.3% <50%> (ø)` | |
| [pandas/tseries/converter.py](https://codecov.io/gh/pandas-dev/pandas/pull/18604/diff?src=pr&el=tree#diff-cGFuZGFzL3RzZXJpZXMvY29udmVydGVyLnB5) | `0% <0%> (-100%)` | :arrow_down: |
| [pandas/tseries/plotting.py](https://codecov.io/gh/pandas-dev/pandas/pull/18604/diff?src=pr&el=tree#diff-cGFuZGFzL3RzZXJpZXMvcGxvdHRpbmcucHk=) | `0% <0%> (-100%)` | :arrow_down: |
| [pandas/plotting/\_compat.py](https://codecov.io/gh/pandas-dev/pandas/pull/18604/diff?src=pr&el=tree#diff-cGFuZGFzL3Bsb3R0aW5nL19jb21wYXQucHk=) | `62% <0%> (-28.91%)` | :arrow_down: |
| [pandas/core/missing.py](https://codecov.io/gh/pandas-dev/pandas/pull/18604/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvbWlzc2luZy5weQ==) | `84.3% <0%> (-7.35%)` | :arrow_down: |
| [pandas/io/parquet.py](https://codecov.io/gh/pandas-dev/pandas/pull/18604/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL3BhcnF1ZXQucHk=) | `65.38% <0%> (-6.42%)` | :arrow_down: |
| [pandas/core/accessor.py](https://codecov.io/gh/pandas-dev/pandas/pull/18604/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYWNjZXNzb3IucHk=) | `93.75% <0%> (-4.97%)` | :arrow_down: |
| [pandas/core/ops.py](https://codecov.io/gh/pandas-dev/pandas/pull/18604/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvb3BzLnB5) | `91.77% <0%> (-4.7%)` | :arrow_down: |
| [pandas/plotting/\_timeseries.py](https://codecov.io/gh/pandas-dev/pandas/pull/18604/diff?src=pr&el=tree#diff-cGFuZGFzL3Bsb3R0aW5nL190aW1lc2VyaWVzLnB5) | `60.73% <0%> (-4.58%)` | :arrow_down: |
| [pandas/io/formats/terminal.py](https://codecov.io/gh/pandas-dev/pandas/pull/18604/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2Zvcm1hdHMvdGVybWluYWwucHk=) | `16.43% <0%> (-4.55%)` | :arrow_down: |
| ... and [116 more](https://codecov.io/gh/pandas-dev/pandas/pull/18604/diff?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/18604?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/18604?src=pr&el=footer). Last update [e84cf2a...7e38b46](https://codecov.io/gh/pandas-dev/pandas/pull/18604?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

> I was also thinking about the possibility of raising a warning instead, and do something like:

Potentially.  I personally don't feel too against just raising for incorrect arguments that we don't explicitly document.  However, let's see what others have to say?  @jreback @jorisvandenbossche ?
the way to do this is to stop passing thru ``**kwds``, rather explicity name any other args (which I don't think there are any), if there are they should be explicity named and in the doc-strings.
> the way to do this is to stop passing thru **kwds, rather explicity name any other args (which I don't think there are any), if there are they should be explicity named and in the doc-strings.

That is indeed the way to go, but currently *kwds* are passed to `TextParser`, so we should investigate if there are possible other keyword arguments that could be used in `read_excel` that are supported by TextParser.
Ok. I'll have a look at TextParser!
can you rebase and respond to comments.
I apologize @jreback. I will get back on it.
this is all fixed up.