Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ImportError: No module named win32com.client

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?

like image 734
user3194189 Avatar asked May 26 '14 06:05

user3194189


People also ask

How do I use win32com client in Python?

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).

Does win32com work on Linux?

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.

What is win32com client dispatch?

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().


1 Answers

pip install pywin32 didn't work for me but pypiwin32 did.

like image 138
Mitch44 Avatar answered Sep 29 '22 05:09

Mitch44