This is the code used to extract data in cells with green background color.
from StyleFrame import StyleFrame
import sys
import pandas
import openpyxl
print("Python version: ", sys.version)
print ("Pandas version: ", pandas.__version__)
print("openpyxl version: ", openpyxl.__version__)
'''
print("StyleFrame version: ", StyleFrame.__version__) ## __version__ not defined
(base) C:\Anaconda\Lib\site-packages>pip show StyleFrame
Name: StyleFrame
Version: 1.6.1
'''
sf = StyleFrame.read_excel('filename.xlsx', read_style=True, use_openpyxl_styles=False)
C:\Anaconda\python.exe C:/Python_Projects/read_excel_colored_cell.py
Python version: 3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 10:22:32) [MSC v.1900 64 bit (AMD64)]
Pandas version: 0.22.0
openpyxl version: 2.2.5
Traceback (most recent call last):
File "C:/Python_Projects/read_excel_colored_cell.py", line 16, in <module>
sf = StyleFrame.read_excel('filename.xlsx', read_style=True, use_openpyxl_styles=False)
File "C:\Anaconda\lib\site-packages\StyleFrame\deprecations.py", line 22, in inner
return func(*args, **kwargs)
File "C:\Anaconda\lib\site-packages\StyleFrame\style_frame.py", line 220, in read_excel
_read_style()
File "C:\Anaconda\lib\site-packages\StyleFrame\style_frame.py", line 209, in _read_style
read_comments and current_cell.comment)
File "C:\Anaconda\lib\site-packages\StyleFrame\styler.py", line 127, in from_openpyxl_style
font_color = theme_colors[openpyxl_style.font.color.theme]
TypeError: list indices must be integers or slices, not Integer
This is the code used to extract data in cells with green background color.
Output is:
File (attached).
filename.xlsx