xlwings No module named 'win32api'

4.9k views Asked by At

Just started learning today. I am trying to use Python to manipulate some data (merge them from several sheets to a single one in a different format). I am following the xlwings installation docs (http://docs.xlwings.org/installation.html#dependencies) which indicate that I need pywin32. It suggests that you use Anaconda which comes with pywin32. I installed Anaconda according to the instructions here (http://continuum.io/downloads#all). Then I went to run some of the xlwings quick start commands

from xlwings import Workbook, Sheet, Range, Chart

and I got the error: No module named 'win32api'

A few notes: 1) I have no idea what pywin32 actually is and how Anaconda comes with it, so if I use any names incorrectly here- that is why. I also have 0 experience with Python so just setting it up has taken me hours 2) I am running 64-bit windows on Parallels on a Macbook pro. My python is 3.4.3 64-bit. The Anaconda I installed is 3.4 64-bit

Any help is greatly appreciated.

2

There are 2 answers

0
Gabriel On

I think I figured out what my issue was. I didn't understand what they meant by "use Anaconda". They meant, run your code directly on the Anaconda environment. I thought Anaconda was an add-on that could be used through the Python IDLE. I basically had to install pywin32 directly onto my Python 34 path, so that I could run my code on the Python IDLE.

0
mnm1300 On

Use python -m pip install pywin32 in the command prompt. I had to do that, and it solved my problem. If that doesn't work, then download and install pywin32 manually.