Extract metadata from Microsoft Office Excel spreadsheets

To extract metadata from Microsoft Office Excel spreadsheets GetMetadata method is used. This method allows to extract the following metadata:

NameDescription
titleThe title of the spreadsheet.
subjectThe subject of the spreadsheet.
keywordsThe keyword of the spreadsheet.
commentsThe comments of the spreadsheet.
content-statusThe content status of the spreadsheet.
categoryThe category of the spreadsheet.
companyThe company of the spreadsheet.
managerThe manager of the spreadsheet.
authorThe name of the spreadsheet’s author.
last-authorThe name of the last spreadsheet’s author.
hyperlink-baseThe base string used for evaluating relative hyperlinks in this spreadsheet.
applicationThe name of the application.
application-versionThe version number of the application that created the spreadsheet.
templateThe informational name of the spreadsheet template.
created-timeThe time of the spreadsheet creation.
last-saved-timeThe time of the the spreadsheet when it was last saved.
last-printed-timeThe time of the spreadsheet when it was last printed.
revision-numberThe spreadsheet revision number.
total-editing-timeThe total editing time in minutes.

Here are the steps to extract metadata from Microsoft Office Excel spreadsheet:

  • Instantiate Parser object for the initial spreadsheet;
  • Call GetMetadata method and obtain collection of document metadata objects;
  • Iterate through the collection and get metadata names and values.
Warning
GetMetadata method returns null value if metadata extraction isn’t supported for the document. For example, metadata extraction isn’t supported for CSV files. Therefore, for CSV file GetMetadata method returns null. If Microsoft Office Excel spreadsheet has no metadata, GetMetadata method returns an empty collection.

The following example demonstrates how to extract metadata from Excel spreadsheet:

// Create an instance of Parser class
using(Parser parser = new Parser(filePath))
{
    // Extract metadata from the spreadsheet
    IEnumerable<MetadataItem> metadata = parser.GetMetadata();
 
    // Iterate over metadata items
    foreach(MetadataItem item in metadata)
    {
        // Print the item name and value
        Console.WriteLine(string.Format("{0}: {1}", item.Name, item.Value));
    }
}

More resources

GitHub examples

You may easily run the code above and see the feature in action in our GitHub examples:

Free online document parser App

Along with full featured .NET library we provide simple, but powerful free Apps.

You are welcome to parse documents and extract data from PDF, DOC, DOCX, PPT, PPTX, XLS, XLSX, Emails and more with our free online Free Online Document Parser App.