how to get document properties from Office files (Word, PowerPoint,Excel)

I have several Office files (Word, PowerPoint, Excel) and I need to get the document properties (for instance, title, subject, creator, keywords, lastModifiedBy, date created, etc.) from R.

I have used the package officer, which is giving me this information for Word and PowerPoint files, but not for Excel files. I use:

library(officer)

PowerPoint file

ppt1<-read_pptx("Slides.pptx")
doc_properties(ppt1)

Word file

doc1<-read_docx("Document.docx")
doc_properties(doc1)

But, as I said, officer does not give document properties for Excel files.

Excel file

exc1<-read_xlsx("Excel_file.xlsx")
doc_properties(exc1)

Error in doc_properties(exc1) : x should be a rpptx or rdocx object.

Is there any other R package to get document properties for Excel files?
Are there any other R packages to get document properties for Word, PowerPoint and Excel files, in a similar way to the officer package?

Thank you.

Maybe

system("cmd", input = "dir c:*.xlsx /q", intern = T)

provides enough information (using the root c: directory as the file location as an example)? Got the idea here.

Thank you zoowalk, but that option does not give the information I need (it seems that the only info it gives is the name of the file, but not the properties of the file).

I need to have the core properties of the file.
Do you have more suggestions?

This is one row of the info i get:

#> [24] "27.02.2009 12:12 11.460 U\myusername file1.xlsx"

Contains date and time of creation as well as username. You can specify the info which the dir command returns. See here.

Interesting, but unfortunately that option it is not giving the document properties information that I need.

You can try to get the document properties of a Word file with officer:

library(officer)
doc1<-read_docx("Document.docx")
doc_properties(doc1)

The doc_properties output is giving the document properties that I need for Word and PowerPoint files, but unfortunately it does not work for Excel files.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.