简体   繁体   中英

Collecting excel file properties using Python 2

I'd like to collect some information about the properties for an excel file, such as:

The Author, Last saved and Last printed.

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

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.

what about (after pip install openpyxl ):

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM