If you've never used Python-Excel before, I can introduce it in a couple words – "Excellent and easy to use library for generating Excel spreadsheets from Python".

If you are familiar and have used it in the past, you may have, at some point been frustrated with creating a background color for a given cell.

This is probably the most counter-intuitive part about Python-Excel.

If you are using EasyXF for your styling (highly recommended), a yellow background-color can be applied with the following example:

nonZeroItemStyle = easyxf("""
         name Arial,
         height 200;
         pattern solid,
         fore_colour yellow;

Items of note:

  1. Be sure to specify pattern solid.
  2. The counter-intuitive part – use the fore_colour style, as opposed to back_colour.

Leave a Reply

Your email address will not be published. Required fields are marked *