Question

win32com is a general library to access COM objects from Python.

One of the major hallmarks of this library is ability to manipulate excel documents.

However, there is lots of customized modules, whose only purpose it to manipulate excel documents, like openpyxl, xlrd, xlwt, python-tablefu.

Are these libraries any better for this specific task? If yes, in what respect?

Was it helpful?

Solution

Open and write directly and efficiently excel files, for instance.

  • win32com uses COM communication, which while being very useful for certain purposes, it needs to perform complicated API calls that can be very slow (so to say, you are using code that controls Windows, that controls Excel)

  • openpyxl or others, just open an excel file, parse it and let you work with it.

Try to populate an excel file with 2000 rows, 100 cells each, with win32com and then with any other direct parser. While a parser needs seconds, win32com will need minutes.

Besides, openpyxl (I haven't tried the others) does not need that excel is installed in the system. It does not even need that the OS is windows.

Totally different concepts. win32com is a piece of art that opens a door to automate almost anything, while the other option is just a file parser. In other words, to iron your shirt, you use a $20 iron, not a 100 ton metal sheet attached to a Lamborghini Diablo.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top