使用Python 2收集Excel文件属性 [英] Collecting excel file properties using Python 2
问题描述
我想收集一些有关excel文件属性的信息,例如:
I'd like to collect some information about the properties for an excel file, such as:
作者,最后保存并最后打印.
The Author, Last saved and Last printed.
这是我用来获取访问时间,修改时间,更改时间和大小的代码. print('访问时间:',time.ctime(os.path.getatime(文件)))
Here is the code I used to get access time, modified time, change time and size. print('Access time :', time.ctime(os.path.getatime(file)))
print('Modified time:', time.ctime(os.path.getmtime(__file__)))
print('Change time :', time.ctime(os.path.getctime(__file__)))
print('Size :', os.path.getsize(__file__))
信息,例如:作者,上次保存,上次打印
information like: author, last saved, last printed
我正在仔细检查以下内容,但没有帮助: https://docs.python.org/2/library/os.path. html
I was looking through these but nothing helpful: https://docs.python.org/2/library/os.path.html
我最初创建/修改的日期和时间与下载的日期/时间有区别.
I have the difference between the original date and time of creation/modification (originally) and the date/time of download.
推荐答案
(在pip install openpyxl
之后):
from openpyxl import load_workbook
wb = load_workbook('foo.xlsx')
wb.properties
参数: creator ='openpyxl',title = None,description = None,subject = None,identifier = None,language = None,created = datetime.datetime(2018,3,11, 14,47,30,624845),Modify = datetime.datetime(2018,3,11,14,47, 30、624851),lastModifiedBy = None,category = None,contentStatus = None, 版本=没有,修订版=没有,关键字=没有,lastPrinted =没有
Parameters: creator='openpyxl', title=None, description=None, subject=None, identifier=None, language=None, created=datetime.datetime(2018, 3, 11, 14, 47, 30, 624845), modified=datetime.datetime(2018, 3, 11, 14, 47, 30, 624851), lastModifiedBy=None, category=None, contentStatus=None, version=None, revision=None, keywords=None, lastPrinted=None
这篇关于使用Python 2收集Excel文件属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!