Extract Metadata from Excel Spreadsheets in C# .NET

Extract Metadata from Excel Spreadsheets in C# .NET

Microsoft Excel files often contain hidden metadata such as the author, company, creation date, last modification time, and more. With GroupDocs.Parser for .NET, 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:

Metadata FieldDescription
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
revision-numberRevision number
total-editing-timeTotal editing time (in minutes)

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 C#

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 metadata items.
  3. Iterate through the collection and print metadata names and values.
// Load the Excel file
using (Parser parser = new Parser(filePath))
{
    // Extract metadata
    IEnumerable<MetadataItem> metadata = parser.GetMetadata();
 
    // Iterate through metadata items
    foreach (MetadataItem item in metadata)
    {
        Console.WriteLine($"{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.

Close
Loading

Analyzing your prompt, please hold on...

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