Search code examples
pythonexceldownloadpywin32win32com

Pywin32not recognized in my computer


I downloaded pywin32 for my computer. I inputted

import win32com.client
x1 = win32.Dispatch("Excel.Application)"

and I get an error saying that win32 is not defined. Is it because I installed it wrong? If so can you give me advice as to fix it?


Solution

  • It appears that the Dispatch function is in the win32com.client module, so you would need to do:

    x1 = win32com.client.Dispatch("Excel.Application")
    

    See the Quick Start to Client side COM and Python documentation for further explanation and examples.