Created
October 10, 2022 22:55
-
-
Save rcsmit/15a30d7d064bb00fc12d60b9318f6a72 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def find_fill_color(cell): | |
"""Find fill color of a cell. | |
Hulproutine, wordt niet aangeroepen in het script | |
# dirty solution to find the fill color. | |
# as solutions given here https://stackoverflow.com/questions/58429823/getting-excel-cell-background-themed-color-as-hex-with-openpyxl | |
# dont work | |
Args: | |
cell (string): The cell you want to find the color from | |
""" | |
val = sh_2022[cell].fill.start_color.rgb | |
try: | |
valx = val[0] | |
valx = val | |
except: | |
valx = sh_2022[cell].fill.start_color.theme | |
theme = sh_2022[cell].fill.start_color.theme | |
tint = sh_2022[cell].fill.start_color.tint | |
st.write(f"Valx = {valx } | Theme = {theme} ||Tint = {tint}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment