OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

TypeError: CellStyle.__init__() got an unexpected keyword argument 'applyFillId'

  • Thread starter Thread starter Timothee Muzaliwa
  • Start date Start date
T

Timothee Muzaliwa

Guest
Been banging my head with this error for a few hours now.

I am trying to read a xlxs file with pandas but i am running through this error.

TypeError: CellStyle.init() got an unexpected keyword argument 'applyFillId'

Here is the code:

Code:
df = pd.read_excel(input_file, sheet_name=_sheetname, skiprows=10, usecols=5, names=_columnnames)

Code:
  df = pd.read_excel(input_file, sheet_name=_sheetname, skiprows=10, usecols=5, names=_columnnames)
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\mtimothe\venv_new\Lib\site-packages\pandas\io\excel\_base.py", line 495, in read_excel
    io = ExcelFile(
         ^^^^^^^^^^
  File "C:\Users\mtimothe\venv_new\Lib\site-packages\pandas\io\excel\_base.py", line 1567, in __init__
    self._reader = self._engines[engine](
                   ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\mtimothe\venv_new\Lib\site-packages\pandas\io\excel\_openpyxl.py", line 553, in __init__
    super().__init__(
  File "C:\Users\mtimothe\venv_new\Lib\site-packages\pandas\io\excel\_base.py", line 573, in __init__
    self.book = self.load_workbook(self.handles.handle, engine_kwargs)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\mtimothe\venv_new\Lib\site-packages\pandas\io\excel\_openpyxl.py", line 572, in load_workbook
    return load_workbook(
           ^^^^^^^^^^^^^^
  File "C:\Users\mtimothe\venv_new\Lib\site-packages\openpyxl\reader\excel.py", line 348, in load_workbook
    reader.read()
  File "C:\Users\mtimothe\venv_new\Lib\site-packages\openpyxl\reader\excel.py", line 301, in read
    apply_stylesheet(self.archive, self.wb)
  File "C:\Users\mtimothe\venv_new\Lib\site-packages\openpyxl\styles\stylesheet.py", line 213, in apply_stylesheet
    stylesheet = Stylesheet.from_tree(node)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\mtimothe\venv_new\Lib\site-packages\openpyxl\styles\stylesheet.py", line 105, in from_tree
    return super(Stylesheet, cls).from_tree(node)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\mtimothe\venv_new\Lib\site-packages\openpyxl\descriptors\serialisable.py", line 87, in from_tree
    obj = desc.expected_type.from_tree(el)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\mtimothe\venv_new\Lib\site-packages\openpyxl\descriptors\serialisable.py", line 87, in from_tree
    obj = desc.expected_type.from_tree(el)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\mtimothe\venv_new\Lib\site-packages\openpyxl\descriptors\serialisable.py", line 103, in from_tree
    return cls(**attrib)
           ^^^^^^^^^^^^^
TypeError: CellStyle.__init__() got an unexpected keyword argument 'applyFillId'

I tried specifying the engine in the parameter to openpyxl but gets the same error.

I expected to get a dataframe that reads the excel file with the specified columns and rows
<p>Been banging my head with this error for a few hours now.</p>
<p>I am trying to read a xlxs file with pandas but i am running through this error.</p>
<blockquote>
<p>TypeError: CellStyle.<strong>init</strong>() got an unexpected keyword argument 'applyFillId'</p>
</blockquote>
<p>Here is the code:</p>
<pre><code>df = pd.read_excel(input_file, sheet_name=_sheetname, skiprows=10, usecols=5, names=_columnnames)
</code></pre>
<pre><code> df = pd.read_excel(input_file, sheet_name=_sheetname, skiprows=10, usecols=5, names=_columnnames)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\mtimothe\venv_new\Lib\site-packages\pandas\io\excel\_base.py", line 495, in read_excel
io = ExcelFile(
^^^^^^^^^^
File "C:\Users\mtimothe\venv_new\Lib\site-packages\pandas\io\excel\_base.py", line 1567, in __init__
self._reader = self._engines[engine](
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\mtimothe\venv_new\Lib\site-packages\pandas\io\excel\_openpyxl.py", line 553, in __init__
super().__init__(
File "C:\Users\mtimothe\venv_new\Lib\site-packages\pandas\io\excel\_base.py", line 573, in __init__
self.book = self.load_workbook(self.handles.handle, engine_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\mtimothe\venv_new\Lib\site-packages\pandas\io\excel\_openpyxl.py", line 572, in load_workbook
return load_workbook(
^^^^^^^^^^^^^^
File "C:\Users\mtimothe\venv_new\Lib\site-packages\openpyxl\reader\excel.py", line 348, in load_workbook
reader.read()
File "C:\Users\mtimothe\venv_new\Lib\site-packages\openpyxl\reader\excel.py", line 301, in read
apply_stylesheet(self.archive, self.wb)
File "C:\Users\mtimothe\venv_new\Lib\site-packages\openpyxl\styles\stylesheet.py", line 213, in apply_stylesheet
stylesheet = Stylesheet.from_tree(node)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\mtimothe\venv_new\Lib\site-packages\openpyxl\styles\stylesheet.py", line 105, in from_tree
return super(Stylesheet, cls).from_tree(node)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\mtimothe\venv_new\Lib\site-packages\openpyxl\descriptors\serialisable.py", line 87, in from_tree
obj = desc.expected_type.from_tree(el)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\mtimothe\venv_new\Lib\site-packages\openpyxl\descriptors\serialisable.py", line 87, in from_tree
obj = desc.expected_type.from_tree(el)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\mtimothe\venv_new\Lib\site-packages\openpyxl\descriptors\serialisable.py", line 103, in from_tree
return cls(**attrib)
^^^^^^^^^^^^^
TypeError: CellStyle.__init__() got an unexpected keyword argument 'applyFillId'
</code></pre>
<p>I tried specifying the engine in the parameter to <strong>openpyxl</strong> but gets the same error.</p>
<p>I expected to get a dataframe that reads the excel file with the specified columns and rows</p>
 

Latest posts

Top