Python Forum
Excel sheet by color - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Excel sheet by color (/thread-23791.html)



Excel sheet by color - abt_python - Jan-17-2020

Hi,

I need to process only that sheet from given excel file whose tab color is YELLOW. Requirement is something like this. My users have an excel file. They highlight the tab in YELLOW color which they modified. So I need to convert only those sheets to csv for further processing. I have code for excel to csv using pandas. But I am not able to identify those sheets only with YELLOW colored. I really appreciate your help here.
I tried using openpyxl, still no luck
ex:
>>> print(ws2.sheet_properties.tabColor)
<openpyxl.styles.colors.Color object>
Parameters:
rgb='FF00B050', indexed=None, auto=None, theme=None, tint=0.0, type='rgb'
Thanks,

ws2.sheet_properties.tabColor.value gave the intended answer


RE: Excel sheet by color - Clunk_Head - Jan-18-2020

This gives you the actual rgb code. You can take action based on that.
ws.sheet_properties.tabColor.rgb