title: Save Excel as HTML in Python
body: <p>I am trying to save an existing Excel file to HTML in Python using <code>win32com.client</code>. Below is my code and the resulting error message. Any suggestions? </p>
  
  <pre><code>import win32com.client as win32
  excel = win32.gencache.EnsureDispatch('Excel.Application')
  wb = excel.Workbooks.Open(r'D:\eclipse\test.xlsx')
  excel.Visible = True
  ws = wb.Worksheets('Sheet1')
  ob = wb.PublishObjects.Add(1,'C:\test.html','Sheet1')
  ob.Publish(True)
  </code></pre>
  
  <p>With the following Traceback:</p>
  
  <pre><code>Traceback (most recent call last):  
  File "D:\eclipse\DMS\AGADMS\exceltohtml.py", line 21, in &lt;module&gt;  
  ob = wb.PublishObjects.Add(1,'C:\test.html')  
  File "C:\Python34\lib\site-packages\win32com\gen_py\00020813-0000-0000-C000-000000000046x0x1x7\PublishObjects.py", line 37, in Add
      , Title)  
  pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2146827284), None)
  </code></pre>