I've mostly only used xlwings to open (read-write
) workbooks (since the workbooks I read have complicated macros). But I've recently begun using openpyxl to open (read-only
) workbooks when I've needed to read thousands of workbooks to scrape some data.
I've noticed that there is a considerable difference between how xlwings and openpyxl read workbooks. I believe xlwings relies on pywin32
to read workbooks. When you read a workbook with xlwings.Book(<filename>)
the actual workbook opens up. I have a feeling this is a result of pywin32
.
However, when using openpyxl.load_workbook(<filename>)
a workbook window does not appear. I have a feeling this is a result of not using pywin32
.
Beyond this, I've no further understanding how the backends work for each libraries. Could someone shine some light on this? Is there a benefit/cost to relying on xlwings
and pywin32
for reading workbooks, as opposed to openpyxl
which does not seem to use pywin32
?