zkanty
zkanty

Reputation: 1

Python Openpyxl change cell color when there is missing value

I have an excel table that looks like this

2013-01-23 08:00:00 +0000 UTC
2013-01-23 09:00:00 +0000 UTC
2013-01-23 10:00:00 +0000 UTC
2013-01-23 11:00:00 +0000 UTC
2013-01-23 12:00:00 +0000 UTC
2013-01-23 13:00:00 +0000 UTC
2013-01-23 15:00:00 +0000 UTC
2013-01-23 16:00:00 +0000 UTC
2013-01-23 19:00:00 +0000 UTC
2013-01-23 20:00:00 +0000 UTC

If the there is missing data like this, where it jumps from 16:00:00 to 19:00:00,

2013-01-23 16:00:00 +0000 UTC
2013-01-23 19:00:00 +0000 UTC

I want to change the font color to red

Is it possible to do that using python openpyxl package?

Upvotes: 0

Views: 1712

Answers (1)

Rakesh
Rakesh

Reputation: 82785

Yes you can change the font color to red using openpyxl . More Info

Example:(From the Docs)

>>> from openpyxl.styles import colors
>>> from openpyxl.styles import Font, Color
>>> from openpyxl import Workbook
>>> wb = Workbook()
>>> ws = wb.active
>>>
>>> a1 = ws['A1']
>>> d4 = ws['D4']
>>> ft = Font(color=colors.RED)
>>> a1.font = ft
>>> d4.font = ft

Upvotes: 1

Related Questions