Excel File Properties

Document properties contain some additional information and details about an Excel file. They are also known as Excel file metadata and can hold information such as author, company, title, and subject.

There are two types of document properties, BuiltIn and Custom.

To learn how to view or change properties for an Office file using Microsoft Office applications, check this article.

The following example shows how to read and write built-in and custom document properties using C# and VB.NET.

Excel file's built-in and custom document properties
Screenshot of document properties from Excel file
Upload your file (Drag file here)
using System;
using GemBox.Spreadsheet;

class Program
    static void Main()
        // If using the Professional version, put your serial key below.

        var workbook = ExcelFile.Load("%InputFileName%");
        var properties = workbook.DocumentProperties;

        Console.WriteLine("# Built-in document properties:");

        // Write built-in document properties.
        properties.BuiltIn[BuiltInDocumentProperties.Title] = "My Spreadsheet Title";
        properties.BuiltIn[BuiltInDocumentProperties.DateLastSaved] = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ssZ");

        // Read built-in document properties.
        foreach (var builtinProperty in properties.BuiltIn)
            Console.WriteLine($"{builtinProperty.Key,20}: {builtinProperty.Value}");

        Console.WriteLine("# Custom document properties:");

        // Write custom document properties.
        properties.Custom["My Custom Property 1"] = "My Custom Value";
        properties.Custom["My Custom Property 2"] = 123.4;

        // Read custom document properties.
        foreach (var customProperty in properties.Custom)
            Console.WriteLine($"{customProperty.Key,20}: {customProperty.Value,-20} [{customProperty.Value.GetType()}]");
Imports System
Imports GemBox.Spreadsheet

Module Program

    Sub Main()

        ' If using the Professional version, put your serial key below.

        Dim workbook = ExcelFile.Load("%InputFileName%")
        Dim properties = workbook.DocumentProperties

        Console.WriteLine("# Built-in document properties:")

        ' Write built-in document properties.
        properties.BuiltIn(BuiltInDocumentProperties.Title) = "My Spreadsheet Title"
        properties.BuiltIn(BuiltInDocumentProperties.DateLastSaved) = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ssZ")

        ' Read built-in document properties.
        For Each builtinProperty In properties.BuiltIn
            Console.WriteLine($"{builtinProperty.Key,20}: {builtinProperty.Value}")

        Console.WriteLine("# Custom document properties:")

        ' Write custom document properties.
        properties.Custom("My Custom Property 1") = "My Custom Value"
        properties.Custom("My Custom Property 2") = 123.4

        ' Read custom document properties.
        For Each customProperty In properties.Custom
            Console.WriteLine($"{customProperty.Key,20}: {customProperty.Value,-20} [{customProperty.Value.GetType()}]")

    End Sub
End Module

See also

Next steps

GemBox.Spreadsheet is a .NET component that enables you to read, write, edit, convert, and print spreadsheet files from your .NET applications using one simple API.

Download Buy