Python通过文件选择器/文件对话框选择2010 Excel xls文件后打开、读取、编辑和保存

2024-05-28 13:41:44 发布

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

我想创建一个可执行程序,弹出一个文件对话框,继续打开、读取、编辑,然后将excel文件保存为新文件。在

enter image description here

目前,我有下面的小脚本,我试图让工作表打开/读取单元格'F8',并至少保存excel文件,但没有得到任何结果。在

from Tkinter import Tk
from tkFileDialog import askopenfilename

Tk().withdraw() # we don't want a full GUI, so keep the root window from appearing
filename = askopenfilename() # show an "Open" dialog box and return the path 
to the selected file
print(filename)

pip install pyexcel

sheet = pyexcel.get_sheet(file_name = filename)
sheet.content
    print(sheet["F8"])

对上面的脚本有什么改进建议吗?在


Tags: 文件thefromimport脚本filenamepyexcelexcel

热门问题