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.
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.
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.
I want to automate some stuff in Excel. Why might I use one over the other?
Does xlwings work on Linux?
Can xlwings run without Excel visible?
What happens to my script if the user has the file open?
I am porting some VBA code to Python and wondering if xlwings is still the best library out there for working with Excel through Python? Or is there something else that you find to be better?
I work in Excel all day, and want to automate some things. If anyone is familiar with these Python libraries, can you tell me why I might use one over the other?