Applying Format to Entire Row Openpyxl : <p>I have an Excel File that I want to format. The first row (excluding Headers so row2) should be red and <em>italicized</em>.</p>

<p>the <a href="http://openpyxl.readthedocs.io/en/2.3.3/styles.html" rel="noreferrer">Openpyxl Documentation states</a>: </p>

<blockquote>
  <p>If you want to apply styles to entire rows and columns then you must apply the style to each cell yourself</p>
</blockquote>

<p>I personally thinks this stinks... Here is my workaround:</p>

<pre><code>import openpyxl
from openpyxl.styles import NamedStyle
from openpyxl import load_workbook
from openpyxl.styles.colors import RED
from openpyxl.styles import Font
# I normally import a lot of stuff... I'll also take suggestions here.

file = 'MY_PATH'
wb = load_workbook(filename=file)
sheet = wb.get_sheet_by_name('Output')

for row in sheet.iter_rows():
    for cell in row:
        if '2' in cell.coordinate:
            # using str() on cell.coordinate to use it in sheet['Cell_here']
            sheet[str(cell.coordinate)].font = Font(color='00FF0000', italic=True)

 wb.save(filename=file)
</code></pre>

<p>The first downside is that if there are more cells such as <code>A24</code> my loop will apply the formatting to it. I can fix this with a regular expression. Would that be the correct approach?</p>

<p><strong>Ultimately- is there a better way to apply a format to the entire row?</strong> Also. Can anyone point me in the right direction to some <em>good</em> Openpyxl documentation? I only found out about <code>sheet.iter_rows()</code> and <code>cell.coordinates</code> on Stack.</p>
