Python and Excel: Overwriting an existing file always prompts, despite XlSaveConflictResolution value

后端 未结 1 1306
深忆病人
深忆病人 2020-12-19 03:29

I\'m using the Excel.Application COM object from a Python program to open a CSV file and save it as an Excel workbook. If the target file already exists, then I am prompted

相关标签:
1条回答
  • 2020-12-19 04:19

    Before saving the file set DisplayAlerts to False to suppress the warning dialog:

    xl.DisplayAlerts = False
    

    After the file is saved it is usually a good idea to set DisplayAlerts back to True:

     xl.DisplayAlerts = True
    
    0 讨论(0)
提交回复
热议问题