How to Update Excel Files Using Python
Learn the basics of openpyxl package and create scripts to improve your daily job.
Introduction
openpyxl
is a Python library to allow you to read and write Excel files using an easy code, thus enabling people to improve work performance.
When I say improve performance, allow me to explain why: I have 13+ years in the IT industry and I may say that many of those were spent behind many Excel sheets and workbooks, as well as writing long VBA codes to automate some tasks.
With openpyxl
library we can use Python to process all the data (like manipulation, explorations) if we have too much data, as well as we can create scripts that will play the same role as the VBA macros, but easier to write and maintain.
Openpyxl Basics
To install and import, same old, same old… pip install openpyxl
if you still don’t have it. Anaconda already brings it, so if you’re using it, just go to import.
from openpyxl import Workbook, load_workbook# If you need to get the column letter, also import this
from openpyxl.utils import get_column_letter