[python-win32] Opening, Modifying, and Saving an Excel File from Python?

Tim Roberts timr at probo.com
Mon Aug 22 23:01:51 CEST 2011


The Little Guy wrote:
>
> Hi,
>
>  
>
> I apologize for the lengthy post. 
>
>  
>
> I’m using Python 2.7, Win 7, Excel 2003.  When trying to enter a time
> object and text data into a, simple, Excel 2003 file.  I’ve tried
> different combinations for saving the file.  I’ve used
> workbook.Save(),  workbook.SaveAs(filename), etc.  Sometimes I receive
> a replace file dialog box, but other times, I receive following
> message, when it tries to save:
>

It is important to remember that none of these cause Excel to exit:
    xlApp.Visible = 0
    xlApp = None
    del xlApp

If you have Excel open with your file and set Visible to 0, it can be
very difficult to remember that your file is still open.  You should use
xlApp.Quit() in every exit path.

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the python-win32 mailing list