diff --git a/doc/source/whatsnew/v0.24.0.txt b/doc/source/whatsnew/v0.24.0.txt
index 7362e11b22189..5d6ed50ca3f26 100644
--- a/doc/source/whatsnew/v0.24.0.txt
+++ b/doc/source/whatsnew/v0.24.0.txt
@@ -377,7 +377,7 @@ I/O
^^^
- :func:`read_html()` no longer ignores all-whitespace ``
`` within ```` when considering the ``skiprows`` and ``header`` arguments. Previously, users had to decrease their ``header`` and ``skiprows`` values on such tables to work around the issue. (:issue:`21641`)
--
+- :func:`read_excel()` will correctly show the deprecation warning for previously deprecated ``sheetname`` (:issue:`17994`)
-
Plotting
diff --git a/pandas/io/excel.py b/pandas/io/excel.py
index 793a95ffb0ee7..fa3a1bd74eda5 100644
--- a/pandas/io/excel.py
+++ b/pandas/io/excel.py
@@ -303,6 +303,16 @@ def read_excel(io,
convert_float=True,
**kwds):
+ # Can't use _deprecate_kwarg since sheetname=None has a special meaning
+ if is_integer(sheet_name) and sheet_name == 0 and 'sheetname' in kwds:
+ warnings.warn("The `sheetname` keyword is deprecated, use "
+ "`sheet_name` instead", FutureWarning, stacklevel=2)
+ sheet_name = kwds.pop("sheetname")
+
+ if 'sheet' in kwds:
+ raise TypeError("read_excel() got an unexpected keyword argument "
+ "`sheet`")
+
if not isinstance(io, ExcelFile):
io = ExcelFile(io, engine=engine)
diff --git a/pandas/tests/io/test_excel.py b/pandas/tests/io/test_excel.py
index 1fda56dbff772..d1eab16e7c22c 100644
--- a/pandas/tests/io/test_excel.py
+++ b/pandas/tests/io/test_excel.py
@@ -219,6 +219,16 @@ def test_excel_passes_na(self, ext):
columns=['Test'])
tm.assert_frame_equal(parsed, expected)
+ def test_deprecated_sheetname(self, ext):
+ # gh-17964
+ excel = self.get_excelfile('test1', ext)
+
+ with tm.assert_produces_warning(FutureWarning, check_stacklevel=False):
+ read_excel(excel, sheetname='Sheet1')
+
+ with pytest.raises(TypeError):
+ read_excel(excel, sheet='Sheet1')
+
def test_excel_table_sheet_by_index(self, ext):
excel = self.get_excelfile('test1', ext)