M$ Office Metadata with R

(The post was originally published at Joes’s Dinner.)

Sometimes I need to retrieve various items of metadata from Microsoft Office files. For the ‘old-style’ (i.e. ‘.doc’ and ‘.xls’) files perhaps a solution in python, such as hachoir, was the best way to extract this data from the ole2 file format – although perhaps it was always possible in R too? When I started digging around for a similar solution for the ‘new-style’ (i.e. ‘.xlsx’ and ‘.docx’) files I was pleasantly surprised to find the file structure is much more open, indeed it is called Office Open XML. I am by no means an expert but basically it is a zipped set of xml type files. This makes getting at the metadata so much easier. I found a simple example in python by zeekay on stack overflow. My code below is an unashamed replication of this in R.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s