In professional environment, there are a lot of tasks that either require a Excel file as source, or one as a delivery, and most of time we ourselves have minimized the workload to an extent that it has become a daily boring task. What if I tell you there is a way to potentially automate the Excel procedure with a little help from Python?

Here is my note taken from this Udemy course.

Setting Environment

  1. Python 3.8.5 32-bit
  2. Sublime Text + Gitbash terminal

Virtual Environment for Project

#to create configuration file for GitBash to take the Python path

echo "alias python='winpty python.exe'" >> ~/.bashrc

python -m venv virt

source virt/Scripts/activate

#can also turn it off

deactivate

pip freeze

pip install openpyxl

Coding Examples

I've put the tutorial codes + data exmaples in my github repository.
Essentially, OpenPyXL is wrapping Excel workbook (you can treat it as a single Excel file) as an instance of the Workbook() Python object, and using Pandas like table slice and cell attributes to modify the value, font and even border of the cell, which give you a lot of freedom to automate a mature and beautiful Excel job.