Python xlsxwriter: Changing individual cell highlight colour
<p>I am writing code in Python using the xlsxwriter module.
My problem is somewhat like other questions here, but with a small twist. I am wanting to change the highlight colour of SPECIFIC INDIVIDUAL cells in Excel. Some cells will already have data entered into them, and I wish to keep that data.</p>

<p>The following is my approach so far:</p>

<pre><code>## Highlights appropriate cells
row = 0
col = 0

blue_fmt = workbook.add_format()
blue_fmt.set_pattern(1)
blue_fmt.set_bg_color('#0000FF')

yellow_fmt = workbook.add_format()
yellow_fmt.set_pattern(1)
yellow_fmt.set_bg_color('#FFFF00')

black_fmt = workbook.add_format()
black_fmt.set_pattern(1)
black_fmt.set_bg_color('#000000')
</code></pre>

<p>I am lost as to how I can instruct my program to highlight specific cells without removing its contents. At the moment, I am thinking some form of iteration would do the trick, but I am worried about losing data already entered into certain cells.</p>

<p>Before:
<a href="https://i.stack.imgur.com/Fx351.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Fx351.jpg" alt="enter image description here"></a></p>

<p>After:
<a href="https://i.stack.imgur.com/YoKni.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YoKni.jpg" alt="enter image description here"></a></p>

<p>Any help or hints are much appreciated.</p>

<p>Thanks in advance.</p>