You are correct in that xlwings relies on pywin32, whereas openpyxl does not.

openpyxl

A ".xlsx" excel file is essentially a zip-file containing multiple XML files formatted according to Microsoft's OOXML specification. With this specification it's possible to create a program capable of directly reading/writing excel files in just about any programming language. This is the approach applied in openpyxl: it uses python code to read/write excel files directly.

xlwings

A Microsoft Excel application can be started and controlled by an external program through the Win32 COM API. The pywin32 package provides an interface between Win32 COM and Python. Through a python script with the right pywin32 commands you can fully control an Excel Application (open excel files, query data from cells, write data to cells, save excel files, etc.). The pywin32 commands that you can use mirror the Excel VBA commands, albeit with python syntax.

xlwings is (among other things) a user-friendly wrapper around pywin32. It introduces several concise-yet-powerful methods. An example would be the methods for direct conversion of an excel cell range to a numpy array or pandas dataframe (and vice versa).

Summary

A fundamental difference between xlwings and openpyxl is that the former requires that MS Excel is installed on your machine, whereas the latter does not.

Answer from Xukrao on Stack Overflow
Top answer
1 of 3
79

You are correct in that xlwings relies on pywin32, whereas openpyxl does not.

openpyxl

A ".xlsx" excel file is essentially a zip-file containing multiple XML files formatted according to Microsoft's OOXML specification. With this specification it's possible to create a program capable of directly reading/writing excel files in just about any programming language. This is the approach applied in openpyxl: it uses python code to read/write excel files directly.

xlwings

A Microsoft Excel application can be started and controlled by an external program through the Win32 COM API. The pywin32 package provides an interface between Win32 COM and Python. Through a python script with the right pywin32 commands you can fully control an Excel Application (open excel files, query data from cells, write data to cells, save excel files, etc.). The pywin32 commands that you can use mirror the Excel VBA commands, albeit with python syntax.

xlwings is (among other things) a user-friendly wrapper around pywin32. It introduces several concise-yet-powerful methods. An example would be the methods for direct conversion of an excel cell range to a numpy array or pandas dataframe (and vice versa).

Summary

A fundamental difference between xlwings and openpyxl is that the former requires that MS Excel is installed on your machine, whereas the latter does not.

2 of 3
0

in-term of simultaneous opening of workbook while using xlwings, you can actually stop it with this statement line1 app=xw.apps.active, line2 if app is none: line3 app=xw.app(visible=False)if you are not comfortable with it. The limitation is that u cannot use xlwing without installing Excel in your local machine, but since you are working with excel you need excel app. but generally xlwing covers a lot as a learner you see the effect of code in Realtime. both of are mostly use your choice depend on your project.

People also ask

Does xlwings work on Linux?
No. It drives a real copy of Excel through COM on Windows or AppleScript on macOS, so a headless Linux container cannot run it. openpyxl and xlsxwriter are the cross-platform options.
🌐
python-excel-automation.com
python-excel-automation.com › home › getting started with python excel automation › choosing a python excel library › when to use xlwings instead of openpyxl
When to Use xlwings Instead of openpyxl · Python Excel Automation
Can xlwings run without Excel visible?
It can run with the application hidden (app.visible = False), but Excel must still be installed and licensed. There is no headless mode in the sense a server operator would mean.
🌐
python-excel-automation.com
python-excel-automation.com › home › getting started with python excel automation › choosing a python excel library › when to use xlwings instead of openpyxl
When to Use xlwings Instead of openpyxl · Python Excel Automation
What happens to my script if the user has the file open?
That is the case xlwings handles best. It attaches to the open workbook and edits it live, where openpyxl would either read a stale copy from disk or fail to save over a locked file.
🌐
python-excel-automation.com
python-excel-automation.com › home › getting started with python excel automation › choosing a python excel library › when to use xlwings instead of openpyxl
When to Use xlwings Instead of openpyxl · Python Excel Automation
🌐
pythontutorials
pythontutorials.net › blog › differences-between-xlwings-vs-openpyxl-reading-excel-workbooks
Xlwings vs Openpyxl: Key Differences in Reading Excel Workbooks – Macro Support, Performance & Bulk Data Scraping
This means Xlwings requires Excel to be installed on the system. ... Full access to Excel’s functionality (formulas, charts, pivot tables). Ability to run and edit VBA macros. Support for both reading and writing Excel files.
🌐
PyXLL
pyxll.com › blog › tools-for-working-with-excel-and-python
Tools for Working with Excel and Python – PyXLL
August 13, 2018 - xlwings · DataNitro · Reading and writing Excel workbooks · OpenPyXL · XlsxWriter · XLTable · Pandas · xlrd and xlwt · pyexcel · Additional Resources · Excel is a well known and really good user interface for many tasks. When you get into more complex tasks and processing larger datasets however you can soon reach the limits of what can sensibly be achieved in Excel.
🌐
Medium
medium.com › trymito › python-and-spreadsheets-are-joining-together-dd69ecc32630
Python and Spreadsheets are Joining Together | by Jake from Mito | trymito | Medium
October 10, 2021 - XLWings is a popular Python package ... to automate Excel processes with Python. It has a lot of over lap to the Openpyxl functionality, but is a bit more robust and well maintained....
🌐
Python-excel-automation
python-excel-automation.com › home › getting started with python excel automation › choosing a python excel library › when to use xlwings instead of openpyxl
When to Use xlwings Instead of openpyxl · Python Excel Automation
3 weeks ago - The pure-Python alternative is to compute the number yourself in pandas and write it as a literal, which is faster and testable — and the right answer whenever the formula is yours. xlwings earns its place when the formulas belong to a model somebody else maintains. Recalculate Excel Formulas Without Excel in Python covers the middle ground. Pivot table caches, slicers, some chart types, ActiveX controls and Power Query connections do not survive an openpyxl round trip.
Find elsewhere
🌐
PyXLL
support.pyxll.com › hc › en-gb › articles › 360042910613-What-is-the-difference-between-PyXLL-and-xlwings
What is the difference between PyXLL and xlwings? – PyXLL
November 2, 2020 - TL;DR: PyXLL is an Excel add-in that embeds Python into Excel for seamless, high performance Excel Python integration. xlwings is a higher level wrapper around the COM/AppleScript Excel Object Model APIs for automating Excel tasks with Python.
🌐
Sheetflash
sheetflash.com › blog › the-best-python-libraries-for-excel-in-2024
The Best Python Libraries for Excel in 2025 | SheetFlash
OpenPyXL suits users who need comprehensive read-write capabilities for modern Excel files. XlsxWriter is great for those focusing on data output and visualization with charts. pyxll offers powerful add-in creation for extending Excel's functionalities through Python. xlwings enables robust ...
🌐
XlsxWriter
xlsxwriter.readthedocs.io › alternatives.html
Alternative modules for handling Excel files — XlsxWriter
openpyxl is a Python library to read/write Excel 2010 xlsx/xlsm/xltx/xltm files. From the xlwings webpage: Leverage Python’s scientific stack for interactive data analysis using Jupyter Notebooks, NumPy, Pandas, scikit-learn etc. As such, xlwings is a free alternative to tools like Power ...
🌐
Xlwings
xlwings.org › blog › reporting-with-python
5 Python Libraries for Reporting and Factsheets - Xlwings
June 3, 2020 - If you need your report as Excel ... - you can still export your Excel document as PDF file. xlwings is the better choice if you want to split the design and code work....
🌐
Experts Exchange
experts-exchange.com › questions › 29282842 › Topics-covered-solely-by-'xlwings'-and-not-by-'openpyxl'.html
Topics covered solely by 'xlwings' and not by 'openpyxl' | Experts Exchange
March 30, 2025 - Approach 1: Pandas/openpyxl/ Excel writer/reader python centric, using python to do everythng reading & writing Excel formatted files. Approach 2: xlwings python code, that every now and then calls on Excel to do something (Excel is the tool, python is the user of Excel).
🌐
Libhunt
python.libhunt.com › compare-xlwings-vs-openpyxl
xlwings vs openpyxl - Awesome Python - LibHunt
Compare xlwings and openpyxl's popularity and activity. Categories: Specific Formats Processing and Office. xlwings is more popular than openpyxl.
🌐
Medium
medium.com › pythoneers › python-integration-with-excel-for-data-analysis-f6eea34cf421
Python Integration with Excel for Data Analysis | The Pythoneers
January 19, 2025 - Use openpyxl for static Excel file operations like formatting and file creation. Use xlwings for dynamic and real-time interaction with open workbooks.
🌐
Libhunt
python.libhunt.com › compare-openpyxl-vs-xlwings
openpyxl vs xlwings | LibHunt
Compare openpyxl and xlwings's popularity and activity. Categories: Specific Formats Processing and Office. openpyxl is less popular than xlwings.