Python Forum

Full Version: Excel sheet by color
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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
This gives you the actual rgb code. You can take action based on that.
ws.sheet_properties.tabColor.rgb