【发布时间】:2021-06-28 10:53:23
【问题描述】:
我有一个单一来源的 Excel 文件,我每个月都会使用 Python 清理它,以便只与我的团队共享选定的数据。我想每个月创建一个新的 excel 文件,而不是每个月更新同一个文件。
例如 - 我已运行 Python 脚本并为 6 月创建了一个干净的文件。当它在 7 月运行时,我希望创建一个新文件,而不是更新 6 月的文件。
希望这是有道理的。提前致谢!
import os.path
from datetime import datetime
curr_date = datetime.strftime(datetime.now(), '%B')
save_path = 'T:/1. 2021 Timesheets n Bandwidth Tracker/Project Database/RA Copy/'
name_of_file = "PRO Project DB_2021_RA_" + curr_date.upper()
completeName = os.path.join(save_path, name_of_file+".xlsx")
file1 = open(completeName, "w")
【问题讨论】:
-
到目前为止你有什么尝试?
-
欢迎来到 *,请使用 tour 并附上 minimal, reproducible example,说明您迄今为止所做的工作和面临的问题。
-
您的数据是什么样的?如何从 Excel 文件中读取数据?