-
Notifications
You must be signed in to change notification settings - Fork 51
Get data from excel cells which have green color as background #44
Copy link
Copy link
Closed
Labels
Description
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)
Output is:
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
File (attached).
filename.xlsx
Reactions are currently unavailable