Repository: modin-project/modin

Issue:
BUG: Can't read xlsx file
### Modin version checks

- [X] I have checked that this issue has not already been reported.

- [X] I have confirmed this bug exists on the latest released version of Modin.

- [X] I have confirmed this bug exists on the main branch of Modin. (In order to do this you can follow [this guide](https://modin.readthedocs.io/en/stable/getting_started/installation.html#installing-from-the-github-master-branch).)


### Reproducible Example

```python
import modin.pandas as pd
import ray
ray.init()

df = pd.read_excel('path/to/file.xlsx')
```


### Issue Description

When I read an excel file, program give an error

### Expected Behavior

don't have

### Error Logs

<details>

```

----> 1 pd.read_excel('[D:/20221014_7AM_452040002437076.xlsx](file:///D:/20221014_7AM_452040002437076.xlsx)')

File [c:\Users\ADMIN\.conda\envs\SuperEnv\lib\site-packages\modin\logging\logger_decorator.py:128](file:///C:/Users/ADMIN/.conda/envs/SuperEnv/lib/site-packages/modin/logging/logger_decorator.py:128), in enable_logging..decorator..run_and_log(*args, **kwargs)
    113 """
    114 Compute function with logging if Modin logging is enabled.
    115 
   (...)
    125 Any
    126 """
    127 if LogMode.get() == "disable":
--> 128     return obj(*args, **kwargs)
    130 logger = get_logger()
    131 logger_level = getattr(logger, log_level)

File [c:\Users\ADMIN\.conda\envs\SuperEnv\lib\site-packages\modin\pandas\io.py:461](file:///C:/Users/ADMIN/.conda/envs/SuperEnv/lib/site-packages/modin/pandas/io.py:461), in read_excel(io, sheet_name, header, names, index_col, usecols, squeeze, dtype, engine, converters, true_values, false_values, skiprows, nrows, na_values, keep_default_na, na_filter, verbose, parse_dates, date_parser, thousands, decimal, comment, skipfooter, convert_float, mangle_dupe_cols, storage_options)
    457 kwargs.pop("mangle_dupe_cols", None)
    459 from modin.core.execution.dispatching.factories.dispatcher import FactoryDispatcher
--> 461 intermediate = FactoryDispatcher.read_excel(**kwargs)
    462 if isinstance(intermediate, (OrderedDict, dict)):
    463     parsed = type(intermediate)()

File [c:\Users\ADMIN\.conda\envs\SuperEnv\lib\site-packages\modin\core\execution\dispatching\factories\dispatcher.py:225](file:///C:/Users/ADMIN/.conda/envs/SuperEnv/lib/site-packages/modin/core/execution/dispatching/factories/dispatcher.py:225), in FactoryDispatcher.read_excel(cls, **kwargs)
    222 @classmethod
    223 @_inherit_docstrings(factories.BaseFactory._read_excel)
    224 def read_excel(cls, **kwargs):
--> 225     return cls.get_factory()._read_excel(**kwargs)

File [c:\Users\ADMIN\.conda\envs\SuperEnv\lib\site-packages\modin\core\execution\dispatching\factories\factories.py:273](file:///C:/Users/ADMIN/.conda/envs/SuperEnv/lib/site-packages/modin/core/execution/dispatching/factories/factories.py:273), in BaseFactory._read_excel(cls, **kwargs)
    265 @classmethod
    266 @doc(
    267     _doc_io_method_template,
   (...)
    271 )
    272 def _read_excel(cls, **kwargs):
--> 273     return cls.io_cls.read_excel(**kwargs)

File [c:\Users\ADMIN\.conda\envs\SuperEnv\lib\site-packages\modin\logging\logger_decorator.py:128](file:///C:/Users/ADMIN/.conda/envs/SuperEnv/lib/site-packages/modin/logging/logger_decorator.py:128), in enable_logging..decorator..run_and_log(*args, **kwargs)
    113 """
    114 Compute function with logging if Modin logging is enabled.
    115 
   (...)
    125 Any
    126 """
    127 if LogMode.get() == "disable":
--> 128     return obj(*args, **kwargs)
    130 logger = get_logger()
    131 logger_level = getattr(logger, log_level)

File [c:\Users\ADMIN\.conda\envs\SuperEnv\lib\site-packages\modin\core\io\file_dispatcher.py:157](file:///C:/Users/ADMIN/.conda/envs/SuperEnv/lib/site-packages/modin/core/io/file_dispatcher.py:157), in FileDispatcher.read(cls, *args, **kwargs)
    134 @classmethod
    135 def read(cls, *args, **kwargs):
    136     """
    137     Read data according passed `args` and `kwargs`.
    138 
   (...)
    155     postprocessing work on the resulting query_compiler object.
    156     """
--> 157     query_compiler = cls._read(*args, **kwargs)
    158     # TextFileReader can also be returned from `_read`.
    159     if not AsyncReadMode.get() and hasattr(query_compiler, "dtypes"):
    160         # at the moment it is not possible to use `wait_partitions` function;
    161         # in a situation where the reading function is called in a row with the
   (...)
    165         # for example, `test_io_exp.py::test_read_evaluated_dict` is failed because of that.
    166         # see #5944 for details

File [c:\Users\ADMIN\.conda\envs\SuperEnv\lib\site-packages\modin\logging\logger_decorator.py:128](file:///C:/Users/ADMIN/.conda/envs/SuperEnv/lib/site-packages/modin/logging/logger_decorator.py:128), in enable_logging..decorator..run_and_log(*args, **kwargs)
    113 """
    114 Compute function with logging if Modin logging is enabled.
    115 
   (...)
    125 Any
    126 """
    127 if LogMode.get() == "disable":
--> 128     return obj(*args, **kwargs)
    130 logger = get_logger()
    131 logger_level = getattr(logger, log_level)

File [c:\Users\ADMIN\.conda\envs\SuperEnv\lib\site-packages\modin\core\io\text\excel_dispatcher.py:144](file:///C:/Users/ADMIN/.conda/envs/SuperEnv/lib/site-packages/modin/core/io/text/excel_dispatcher.py:144), in ExcelDispatcher._read(cls, io, **kwargs)
    142 footer = b"</sheetData></worksheet>"
    143 # Use openpyxml to parse the data
--> 144 reader = WorksheetReader(
    145     ws,
    146     BytesIO(sheet_header_with_first_row + footer),
    147     ex.shared_strings,
    148     False,
    149 )
    150 # Attach cells to the worksheet
    151 reader.bind_cells()

TypeError: __init__() missing 1 required positional argument: 'rich_text'

```

</details>


### Installed Versions

<details>

0.21.0

</details>

Sample file: [20221014_7AM_452040000244888.xlsx](https://github.com/modin-project/modin/files/11620190/20221014_7AM_452040000244888.xlsx)



Discussion:
Hi @HiImVanPhuTran, please provide the whole error traceback, not just the last exception line, otherwise it's pretty impossible to understand what's going wrong.

Would also be awesome if you could share an example `.xlsx` file which yields this error, so we can reproduce and investigate.
@vnlitvinov, I Edited. Wish you can help. Thanks.
Hi @HiImVanPhuTran, thanks for the update. I can not reproduce this on my end, but I now have certain suspicions.

Could you please run `python -m modin --version` and post back the output? Or, if you're using it exclusively from, say, Jupyter notebook, run a cell with 
```python
import modin.pandas as pd
pd.show_versions()
```
and post its output? The two are reporting the same thing, so it is enough to post back any of them.
Looks similar to https://github.com/modin-project/modin/issues/5642
@vnlitvinov here.
INSTALLED VERSIONS
------------------
commit           : 46cb44bd0cc7cb599bc5cf4edea3cd13f10a35a2
python           : 3.8.0.final.0
python-bits      : 64
OS               : Windows
OS-release       : 10
Version          : 10.0.18362
machine          : AMD64
processor        : Intel64 Family 6 Model 79 Stepping 1, GenuineIntel
byteorder        : little
LC_ALL           : None
LANG             : None
LOCALE           : English_United States.1252

Modin dependencies
------------------
modin            : 0.21.0+7.g46cb44bd
ray              : 2.3.0
dask             : 2023.4.1
distributed      : 2023.4.1
hdk              : None

pandas dependencies
-------------------
pandas           : 1.5.3
numpy            : 1.22.3
pytz             : 2023.3
dateutil         : 2.8.2
setuptools       : 66.0.0
pip              : 23.0.1
Cython           : None
pytest           : None
hypothesis       : None
sphinx           : None
blosc            : None
feather          : None
xlsxwriter       : None
lxml.etree       : None
html5lib         : None
pymysql          : None
psycopg2         : 2.9.6
jinja2           : 3.1.2
IPython          : 8.12.2
pandas_datareader: None
bs4              : 4.12.2
bottleneck       : 1.3.5
brotli           :
fastparquet      : None
fsspec           : 2023.5.0
gcsfs            : None
matplotlib       : None
numba            : None
numexpr          : 2.8.4
odfpy            : None
openpyxl         : 3.1.2
pandas_gbq       : None
pyarrow          : None
pyreadstat       : None
pyxlsb           : None
s3fs             : None
scipy            : 1.10.1
snappy           : None
sqlalchemy       : 2.0.8
tables           : None
tabulate         : None
xarray           : None
xlrd             : None
xlwt             : None
zstandard        : None
tzdata           : 2023.3
@HiImVanPhuTran maybe it can help you https://github.com/modin-project/modin/issues/5642#issuecomment-1426869727. Could you try?

Resolving patch:
diff --git a/modin/core/io/text/excel_dispatcher.py b/modin/core/io/text/excel_dispatcher.py
--- a/modin/core/io/text/excel_dispatcher.py
+++ b/modin/core/io/text/excel_dispatcher.py
@@ -141,12 +141,16 @@ def _read(cls, io, **kwargs):
             kwargs["_header"] = sheet_header
             footer = b"</sheetData></worksheet>"
             # Use openpyxml to parse the data
-            reader = WorksheetReader(
+            common_args = (
                 ws,
                 BytesIO(sheet_header_with_first_row + footer),
                 ex.shared_strings,
                 False,
             )
+            if cls.need_rich_text_param:
+                reader = WorksheetReader(*common_args, rich_text=False)
+            else:
+                reader = WorksheetReader(*common_args)
             # Attach cells to the worksheet
             reader.bind_cells()
             data = PandasExcelParser.get_sheet_data(
diff --git a/modin/core/storage_formats/pandas/parsers.py b/modin/core/storage_formats/pandas/parsers.py
--- a/modin/core/storage_formats/pandas/parsers.py
+++ b/modin/core/storage_formats/pandas/parsers.py
@@ -534,6 +534,20 @@ def _convert_cell(cls, cell, convert_float):
 
         return cell.value
 
+    @property
+    def need_rich_text_param(self):
+        """
+        Determine whether a required `rich_text` parameter should be specified for the ``WorksheetReader`` constructor.
+
+        Returns
+        -------
+        bool
+        """
+        import openpyxl
+        from packaging import version
+
+        return version.parse(openpyxl.__version__) >= version.parse("3.1.0")
+
     @staticmethod
     @doc(_doc_parse_func, parameters=_doc_parse_parameters_common)
     def parse(fname, **kwargs):
@@ -550,7 +564,7 @@ def parse(fname, **kwargs):
             return pandas.read_excel(fname, **kwargs)
 
         from zipfile import ZipFile
-        from openpyxl import load_workbook
+        import openpyxl
         from openpyxl.worksheet._reader import WorksheetReader
         from openpyxl.reader.excel import ExcelReader
         from openpyxl.worksheet.worksheet import Worksheet
@@ -562,7 +576,7 @@ def parse(fname, **kwargs):
         from pandas.io.parsers import TextParser
         import re
 
-        wb = load_workbook(filename=fname, read_only=True)
+        wb = openpyxl.load_workbook(filename=fname, read_only=True)
         # Get shared strings
         ex = ExcelReader(fname, read_only=True)
         ex.read_manifest()
@@ -610,7 +624,11 @@ def update_row_nums(match):
         bytes_data = re.sub(rb'r="[A-Z]*\d+"', update_row_nums, bytes_data)
         bytesio = BytesIO(excel_header + bytes_data + footer)
         # Use openpyxl to read/parse sheet data
-        reader = WorksheetReader(ws, bytesio, ex.shared_strings, False)
+        common_args = (ws, bytesio, ex.shared_strings, False)
+        if PandasExcelParser.need_rich_text_param:
+            reader = WorksheetReader(*common_args, rich_text=False)
+        else:
+            reader = WorksheetReader(*common_args)
         # Attach cells to worksheet object
         reader.bind_cells()
         data = PandasExcelParser.get_sheet_data(ws, kwargs.pop("convert_float", True))


Test patch: