How to Solve NameError: name 'PatternFill' is not defined -- openpyxl

Solution: Import the 'PatternFill' module

To Solve the error, add the following line to the top of your code.

from openpyxl.styles import PatternFill

 

For more information:
Python openpyxl PatternFill