I am currently using python 2.7 and trying to open an Excel sheet. When using the code below:
import os from win32com.client import Dispatch xlApp = win32com.client.Dispatch("Excel.Application") xlApp.Visible = True # Open the file we want in Excel workbook = xlApp.Workbooks.Open('example.xls')
I get this error:
ImportError: No module named win32com.client
Is there any possibility of getting the error since I am using 64-bit Windows machine?
Run ' win32com\client\makepy.py ' (eg, run it from the command window, or double-click on it) and a list will be presented. Select the Type Library ' Microsoft Word 8.0 Object Library ' From a command prompt, run the command ' makepy.py "Microsoft Word 8.0 Object Library" ' (include the double quotes).
Certainly not. win32com looks like a Windows specific library, tied to the WinAPI. Linux has a different operating system API (because Linux is not Windows and both are different OSes), mostly following the POSIX standards.
The win32com. client package contains a number of modules to provide access to automation objects. This package supports both late and early bindings, as we will discuss. To use an IDispatch-based COM object, use the method win32com.client.Dispatch().
pip install pywin32
didn't work for me but pypiwin32
did.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With