Skip to content

Instantly share code, notes, and snippets.

@rcsmit
Created October 10, 2022 22:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rcsmit/15a30d7d064bb00fc12d60b9318f6a72 to your computer and use it in GitHub Desktop.
Save rcsmit/15a30d7d064bb00fc12d60b9318f6a72 to your computer and use it in GitHub Desktop.
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