Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save fileformat-cells-gists/d9e4f31e6d24199737a4993931dde324 to your computer and use it in GitHub Desktop.
Save fileformat-cells-gists/d9e4f31e6d24199737a4993931dde324 to your computer and use it in GitHub Desktop.
Get Document Properties to a Workbook in C#
string filePath = "/path/to/existing/spreadsheet.xlsx"; // Replace with the path to your file
// Open the existing workbook.
using (var workbook = new Workbook(filePath))
{
// Retrieve and display the document properties.
var properties = workbook.BuiltinDocumentProperties;
DisplayProperties(properties);
}
// Helper method to display document properties.
static void DisplayProperties(BuiltInDocumentProperties properties)
{
Console.WriteLine($"Author: {properties.Author}");
Console.WriteLine($"Title: {properties.Title}");
Console.WriteLine($"Created Date: {properties.CreatedDate}");
Console.WriteLine($"Modified By: {properties.ModifiedBy}");
Console.WriteLine($"Modified Date: {properties.ModifiedDate}");
Console.WriteLine($"Subject: {properties.Subject}");
Console.WriteLine("=================================");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment