File tree Expand file tree Collapse file tree 3 files changed +13
-1
lines changed Expand file tree Collapse file tree 3 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -230,3 +230,5 @@ Bug Fixes
230230
231231
232232- Bug in ``df.replace`` while replacing value in mixed dtype ``Dataframe`` (:issue:`11698`)
233+
234+ - Bug in ``read_excel`` failing to read any non-empty sheets when empty sheets exist and ``sheetname=None`` (:issue:`11711`)
Original file line number Diff line number Diff line change @@ -391,7 +391,8 @@ def _parse_cell(cell_contents,cell_typ):
391391 data .append (row )
392392
393393 if sheet .nrows == 0 :
394- return DataFrame ()
394+ output [asheetname ] = DataFrame ()
395+ continue
395396
396397 if com .is_list_like (header ) and len (header ) == 1 :
397398 header = header [0 ]
Original file line number Diff line number Diff line change @@ -382,6 +382,15 @@ def test_reading_multiple_specific_sheets(self):
382382 tm .assert_contains_all (expected_keys , dfs .keys ())
383383 assert len (expected_keys ) == len (dfs .keys ())
384384
385+ def test_reading_all_sheets_with_blank (self ):
386+ # Test reading all sheetnames by setting sheetname to None,
387+ # In the case where some sheets are blank.
388+ # Issue #11711
389+ basename = 'blank_with_header'
390+ dfs = self .get_exceldf (basename , sheetname = None )
391+ expected_keys = ['Sheet1' , 'Sheet2' , 'Sheet3' ]
392+ tm .assert_contains_all (expected_keys , dfs .keys ())
393+
385394 # GH6403
386395 def test_read_excel_blank (self ):
387396 actual = self .get_exceldf ('blank' , 'Sheet1' )
You can’t perform that action at this time.
0 commit comments