在 python 3.6 中提取 xlsx 工作簿文件元数据/属性 [英] Extract xlsx workbook file metadata/properties in python 3.6

查看:55
本文介绍了在 python 3.6 中提取 xlsx 工作簿文件元数据/属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用 Python 读取存储在 xlsx 文件中的属性/元数据,如标题、作者、主题、最后修改时间和关键字?我已经使用了 xlrd 库,但是没有这样的属性来提取这些实体.任何帮助表示赞赏

How can I read the properties/metadata like Title, Author, Subject, Last modified and Keywords stored in a xlsx file using Python? I've used xlrd library however, there are no such properties to extract theses entities. Any Help is appreciated

推荐答案

您可能对 openpyxl:

帮助您入门的内容可能如下所示:

Something to get you started may look like:

from openpyxl import load_workbook
wb = load_workbook('yourfile.xlsx')
wb.properties

这是示例输出:

<openpyxl.packaging.core.DocumentProperties object>
Parameters:
creator=u'User', title=None, description=None, subject=None, identifier=None,
language=None, created=datetime.datetime(2018, 12, 11, 9, 55, 2),
modified=datetime.datetime(2018, 12, 11, 10, 30, 38), lastModifiedBy=u'User',
category=None, contentStatus=None, version=None, revision=None, keywords=None,
lastPrinted=None

这是您可以使用的东西吗?

Is this something you can work with?

这篇关于在 python 3.6 中提取 xlsx 工作簿文件元数据/属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆