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

python openpyxl.load_workbook TypeError: Fill() takes no arguments

  • Thread starter Thread starter nathyxy
  • Start date Start date
N

nathyxy

Guest
I want to read the backgrounf colors from an excel sheet. I'm trying this with openpyxl, but when i try to load the file openpyxl.load_workbook("myfile.xlsx", data_only=True) I got the following error:

Code:
Traceback (most recent call last):
  File "\openpyxl\descriptors\base.py", line 55, in _convert
    value = expected_type(value)
TypeError: Fill() takes no arguments

During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "\openpyxl\reader\excel.py", line 315, in load_workbook
    reader.read()
  File "\openpyxl\reader\excel.py", line 279, in read
    apply_stylesheet(self.archive, self.wb)
  File "\openpyxl\styles\stylesheet.py", line 192, in apply_stylesheet
    stylesheet = Stylesheet.from_tree(node)
  File "\openpyxl\styles\stylesheet.py", line 102, in from_tree
    return super(Stylesheet, cls).from_tree(node)
  File "\openpyxl\descriptors\serialisable.py", line 103, in from_tree
    return cls(**attrib)
  File "\openpyxl\styles\stylesheet.py", line 73, in __init__
    self.fills = fills
  File "\openpyxl\descriptors\sequence.py", line 26, in __set__
    seq = [_convert(self.expected_type, value) for value in seq]
  File "\openpyxl\descriptors\sequence.py", line 26, in <listcomp>
    seq = [_convert(self.expected_type, value) for value in seq]
  File "\openpyxl\descriptors\base.py", line 57, in _convert
    raise TypeError('expected ' + str(expected_type))
TypeError: expected <class 'openpyxl.styles.fills.Fill'>

What can I do to obtain this issue and read bg color like here: Get cell color from .xlsx ?
<p>I want to read the backgrounf colors from an excel sheet. I'm trying this with openpyxl, but when i try to load the file
<code>openpyxl.load_workbook("myfile.xlsx", data_only=True)</code>
I got the following error:</p>
<pre><code>Traceback (most recent call last):
File "\openpyxl\descriptors\base.py", line 55, in _convert
value = expected_type(value)
TypeError: Fill() takes no arguments

During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "\openpyxl\reader\excel.py", line 315, in load_workbook
reader.read()
File "\openpyxl\reader\excel.py", line 279, in read
apply_stylesheet(self.archive, self.wb)
File "\openpyxl\styles\stylesheet.py", line 192, in apply_stylesheet
stylesheet = Stylesheet.from_tree(node)
File "\openpyxl\styles\stylesheet.py", line 102, in from_tree
return super(Stylesheet, cls).from_tree(node)
File "\openpyxl\descriptors\serialisable.py", line 103, in from_tree
return cls(**attrib)
File "\openpyxl\styles\stylesheet.py", line 73, in __init__
self.fills = fills
File "\openpyxl\descriptors\sequence.py", line 26, in __set__
seq = [_convert(self.expected_type, value) for value in seq]
File "\openpyxl\descriptors\sequence.py", line 26, in <listcomp>
seq = [_convert(self.expected_type, value) for value in seq]
File "\openpyxl\descriptors\base.py", line 57, in _convert
raise TypeError('expected ' + str(expected_type))
TypeError: expected <class 'openpyxl.styles.fills.Fill'>
</code></pre>
<p>What can I do to obtain this issue and read bg color like here: <a href="https://stackoverflow.com/questions/32736419/get-cell-color-from-xlsx">Get cell color from .xlsx</a> ?</p>
 
Top