如何使用xlwings生成的名称保存和关闭文件?

2024-03-28 21:30:43 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在试图保存excel,它是一个xlwings的结果, 我可以看到excel,但无法保存它。我如何解决这个问题

wb.save(r'C:¥Users¥my_path¥abstract_'+date_now+'.xlsx')
wb.close()

这就是我得到的错误

com_error: (-2147352567, 'Exception occurred.', (0, 'Microsoft Excel', "Microsoft Excel cannot access the file 'C:\\Users\\my_path\\EAA8CD00'. There are several possible reasons:\n\n• The file name or path does not exist.\n• The file is being used by another program.\n• The workbook you are trying to save has the same name as a currently open workbook.", 'xlmain11.chm', 0, -2146827284), None)

顺便说一句,我的文件夹中没有同名文件


Tags: thepathnamemysavexlwingsexcelusers