I am trying to apply conditional formatting in Python using xlsxwriter, but am unsure of how to reference the entire sheet instead of just a range of cells. I need the sheet to be referenced as opposed to a set range of cells so that when the data frame auto updates with new data, that new data will still be captured in the conditional formatting rule. The data frame just captures daily stock prices.
With this conditional formatting rule I am basically trying to say if the cell is less than the cell to the left of it, then apply format 1.
Here is what I was trying:
worksheet1.conditional_format('$1:$1048576', {'type': 'cell',
'criteria': 'less than',
'value' : 'OFFSET(INDIRECT(ADDRESS(ROW(),
COLUMN())),0,-1)',
'format': format1})
What I am trying to change is the $1:$1048576 as this is not referencing the entire sheet but instead giving me an error message:
ValueError: invalid literal for int() with base 10: '$1:$1048576'
Thank you in advance for the help!