Repository: modin-project/modin

Issue:
read_excel fails when engine is set to openpyxl
### System information
- **OS Platform and Distribution (e.g., Linux Ubuntu 16.04)**: RHEL 7.8
- **Modin version** (`modin.__version__`): 0.8.0
- **Python version**: 3.8.0
- **Code we can use to reproduce**:
import modin.pandas as pd
data = pd.read_excel("CREATE_SLT_WITHOUT_ERROR.xlsx", engine="openpyxl")


### Describe the problem
When I try reading any excel sheet with multiple sheets, it fails with KeyError: "There is no item named 'xl/worksheets/info.xml' in the archive"
It works fine when the excel has just one sheet but it fails when the excel has multiple sheets.
### Source code / logs
The error stacktrace look like this:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/modin/pandas/io.py", line 255, in read_excel
    intermediate = EngineDispatcher.read_excel(**kwargs)
  File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/modin/data_management/dispatcher.py", line 131, in read_excel
    return cls.__engine._read_excel(**kwargs)
  File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/modin/data_management/factories.py", line 72, in _read_excel
    return cls.io_cls.read_excel(**kwargs)
  File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/modin/engines/base/io/file_reader.py", line 29, in read
    query_compiler = cls._read(*args, **kwargs)
  File "/opt/rh/rh-python38/root/usr/local/lib/python3.8/site-packages/modin/engines/base/io/text/excel_reader.py", line 74, in _read
    f = z.open("xl/worksheets/{}.xml".format(sheet_name.lower()))
  File "/opt/rh/rh-python38/root/usr/lib64/python3.8/zipfile.py", line 1479, in open
    zinfo = self.getinfo(name)
  File "/opt/rh/rh-python38/root/usr/lib64/python3.8/zipfile.py", line 1406, in getinfo
    raise KeyError(
KeyError: "There is no item named 'xl/worksheets/info.xml' in the archive"

The file attached can be used to re-create the scenario:
[CREATE_SLT_WITHOUT_ERROR.xlsx](https://github.com/modin-project/modin/files/5069052/CREATE_SLT_WITHOUT_ERROR.xlsx)



Discussion:
I have the exact same issue, haven't been able to open any Excel files with modin. Had to flip back to pandas with multiprocessing
Thanks @deathsaber and @hoveybr for the report and reproducible file. I can reproduce the issue.

I will make sure we get this resolved. Thanks again!
I also met this problem. Is there any solution at present

Resolving patch:
diff --git a/modin/backends/pandas/parsers.py b/modin/backends/pandas/parsers.py
--- a/modin/backends/pandas/parsers.py
+++ b/modin/backends/pandas/parsers.py
@@ -299,8 +299,10 @@ def update_row_nums(match):
             usecols=usecols,
             **kwargs
         )
-
-        pandas_df = parser.read()
+        # In excel if you create a row with only a border (no values), this parser will
+        # interpret that as a row of NaN values. Pandas discards these values, so we
+        # also must discard these values.
+        pandas_df = parser.read().dropna(how="all")
         # Since we know the number of rows that occur before this partition, we can
         # correctly assign the index in cases of RangeIndex. If it is not a RangeIndex,
         # the index is already correct because it came from the data.
diff --git a/modin/engines/base/io/text/excel_reader.py b/modin/engines/base/io/text/excel_reader.py
--- a/modin/engines/base/io/text/excel_reader.py
+++ b/modin/engines/base/io/text/excel_reader.py
@@ -65,9 +65,14 @@ def _read(cls, io, **kwargs):
         ex.read_manifest()
         ex.read_strings()
         ws = Worksheet(wb)
-        # Convert string name 0 to string
-        if sheet_name == 0:
-            sheet_name = wb.sheetnames[sheet_name]
+        # Convert index to sheet name in file
+        if isinstance(sheet_name, int):
+            sheet_name = "sheet{}".format(sheet_name + 1)
+        else:
+            sheet_name = "sheet{}".format(wb.sheetnames.index(sheet_name) + 1)
+        # Pass this value to the workers
+        kwargs["sheet_name"] = sheet_name
+
         with ZipFile(io) as z:
             from io import BytesIO
 
@@ -201,4 +206,7 @@ def _read(cls, io, **kwargs):
             column_widths,
             dtypes=dtypes,
         )
-        return cls.query_compiler_cls(new_frame)
+        new_query_compiler = cls.query_compiler_cls(new_frame)
+        if index_col is None:
+            new_query_compiler._modin_frame._apply_index_objs(axis=0)
+        return new_query_compiler


Test patch:
diff --git a/modin/pandas/test/data/modin_error_book.xlsx b/modin/pandas/test/data/modin_error_book.xlsx
new file mode 100644
Binary files /dev/null and b/modin/pandas/test/data/modin_error_book.xlsx differ
diff --git a/modin/pandas/test/test_io.py b/modin/pandas/test/test_io.py
--- a/modin/pandas/test/test_io.py
+++ b/modin/pandas/test/test_io.py
@@ -635,6 +635,17 @@ def test_from_excel_all_sheets():
     teardown_excel_file()
 
 
+@pytest.mark.parametrize(
+    "sheet_name",
+    ["Sheet1", "AnotherSpecialName", "SpecialName", "SecondSpecialName", 0, 1, 2, 3],
+)
+def test_from_excel_sheet_name(sheet_name):
+    fname = "modin/pandas/test/data/modin_error_book.xlsx"
+    modin_df = pd.read_excel(fname, sheet_name=sheet_name)
+    pandas_df = pandas.read_excel(fname, sheet_name=sheet_name)
+    df_equals(modin_df, pandas_df)
+
+
 # @pytest.mark.skip(reason="Arrow version mismatch between Pandas and Feather")
 def test_from_feather():
     setup_feather_file(SMALL_ROW_SIZE)