[英]How to automatically open and close an .xlsm file
I have generate.xlsm
file.我有
generate.xlsm
文件。 When I open it in Windows manually, the report.csv
file is updated.当我在 Windows 手动打开它时,
report.csv
文件被更新。
I need to open and close generate.xlsm
every day.我需要每天打开和关闭
generate.xlsm
。 I tried to open it with python both in Linux and in Windows using the following:我尝试在 Linux 和 Windows 中使用 python 打开它:
f= open(filename)
f.close()
and the following:以及以下内容:
import openpyxl
book = openpyxl.load_workbook(filename, keep_vba=True)
book.close()
but neither of them updates the report.csv
file.但他们都没有更新
report.csv
文件。
So I would like to know if there is a way to open and close an.xlsm file or maybe it is possible to schedule a task in Windows that not only opens but also closes the file.所以我想知道是否有办法打开和关闭一个 .xlsm 文件,或者是否可以在 Windows 中安排一个任务,该任务不仅打开而且关闭文件。
I could open and close the.xlsm file by creating a .vbs
file.我可以通过创建
.vbs
文件来打开和关闭 .xlsm 文件。 I used the following question and solution: How to close excel file .我使用了以下问题和解决方案: 如何关闭 excel 文件。
Then I scheduled a task for the.vbs file in Windows.然后我为Windows中的.vbs文件安排了一个任务。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.