
When developing C# applications that interact with Excel spreadsheets—especially for automated workflows, auditing systems, or document management—it’s important to access Excel metadata like the author, title, subject, and modification dates. These built-in document properties help streamline document processing and organization.
In this guide, you’ll learn how to read Excel document properties in C# using the Openize.OpenXML-SDK. It’s a powerful, lightweight C# library that lets you work with Excel files programmatically—without needing Microsoft Excel installed.
How to Read Excel Metadata with Openize.OpenXML-SDK
The built-in metadata in Excel includes:
- Author
- Title
- Subject
- Created Date
- Modified By
- Modified Date
These values are essential for document auditing, validation, and reporting systems. Let’s see how to extract these using Openize.OpenXML.
Here’s the code snippet used in our demonstration:
Step-by-Step Code Explanation
Defining the File Path
Start by specifying the full path to the Excel file (.xls or .xlsx) you want to analyze. Ensure the file exists to avoid file-not-found exceptions.Loading the Workbook
Using the Workbook class from Openize.OpenXML for .NET, load the spreadsheet. A using block ensures that resources are released properly after reading the file, which is crucial in high-volume or server-side environments.Accessing Built-In Document Properties
After loading the Workbook, retrieve the document metadata via the BuiltinDocumentProperties property. This exposes standard Excel file metadata fields such as Author, Title, CreatedDate, etc.Outputting Metadata
The metadata is then displayed using a helper method. This can be extended to log data, push it into a database, or use it in larger workflows.
Why Use Openize.OpenXML-SDK for Excel File Metadata?
Excel-Free Metadata Extraction
Openize.OpenXML-SDK does not depend on Microsoft Excel, making it ideal for server applications, microservices, and containers running on Linux or Windows.
Efficient and Scalable
Openize.OpenXML-SDK is optimized for performance and handles large Excel files effortlessly. It’s a robust solution for processing thousands of documents in real-time or via scheduled jobs.
Powerful and Flexible API
The SDK provides an extensive set of APIs—not just for reading metadata, but also for working with Excel content, formatting, formulas, charts, and more.
Easy .NET Integration
Whether you’re building a WPF desktop app, a Web API, or a background processing service, Openize.OpenXML-SDK integrates seamlessly with your C# application.
Use Cases in Real Projects
- Metadata Validation Workflows: Automatically verify that Excel files contain required fields before approval or upload.
- Compliance and Auditing Systems: Track who created or edited documents and when—vital for regulated industries.
- Batch Metadata Reporting: Extract and report metadata from thousands of spreadsheets for analytics or archiving.
Conclusion
Retrieving document properties from Excel in C# is a crucial step in document automation and auditing. With Openize.OpenXML, this becomes a streamlined and code-efficient task. By leveraging this SDK, developers can build powerful tools that read Excel metadata without Excel installed, ensuring scalability, speed, and reliability.
Whether you’re processing files in bulk or building intelligent workflows, integrating document metadata extraction into your C# application adds immense value.