Extract metadata from Microsoft Office Excel spreadsheets

Microsoft Excel files often contain hidden metadata such as the author, company, creation date, last modification time, and more. With GroupDocs.Parser for Java, you can easily extract this metadata from Excel spreadsheets (.xls and .xlsx) using the getMetadata method.

This guide explains how to extract Excel file metadata programmatically in just a few steps.


What metadata can be extracted?

The getMetadata method allows you to access a wide range of Excel spreadsheet properties:

NameDescription
titleSpreadsheet title
subjectSpreadsheet subject
keywordsSpreadsheet keywords
commentsUser comments
content-statusStatus of the spreadsheet
categorySpreadsheet category
companyCompany name
managerManager name
authorOriginal author
last-authorLast modified by
hyperlink-baseBase URL for relative hyperlinks
applicationApplication used to create the file
application-versionVersion of the application
templateTemplate name
created-timeCreation time
last-saved-timeLast saved timestamp
last-printed-timeLast printed timestamp
total-editing-timeTotal editing time (in minutes)

Properties that are empty in the spreadsheet are not included in the result.


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.

How to extract Excel metadata in Java

Follow these steps to extract metadata from an Excel file:

  1. Instantiate the Parser object for the Excel spreadsheet.
  2. Call the getMetadata method to retrieve all MetadataItem objects.
  3. Iterate through the collection and print metadata names and values.
// Create an instance of Parser class
try (Parser parser = new Parser(Constants.SampleXlsx)) {
    // Extract metadata from the spreadsheet
    Iterable<MetadataItem> metadata = parser.getMetadata();
    // Iterate over metadata items
    for (MetadataItem item : metadata) {
        // Print an item name and value
        System.out.println(String.format("%s: %s", item.getName(), item.getValue()));
    }
}

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 Java 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.

Close
Loading

Analyzing your prompt, please hold on...

An error occurred while retrieving the results. Please refresh the page and try again.