How to Edit Workbook Metadata
Metadata for an Excel spreadsheet includes information about the title, author, subject, keywords, creation date, modification date, and other relevant details. Metadata provides context and helps in organizing and categorizing spreadsheets. It simplifies file search and management, especially when working with multiple spreadsheet files.
The IronXL library offers the capability to edit workbook metadata without the need for Office Interop.
How to Edit Workbook Metadata
- Download the C# library to edit workbook metadata
- Load an existing spreadsheet or create a brand new one
- Access and modify the metadata information using the Metadata property
- View and modify the spreadsheet data
- Export the spreadsheet with the edited metadata properties
Get started with IronXL
Start using IronXL in your project today with a free trial.
Edit Workbook Metadata Example
To edit the author name of a spreadsheet file, set the Author
property with the desired string of data. For example, workBook.Metadata.Author = "Your Name"
. The metadata information available in the Metadata
property of WorkBook
class can be accessed and retrieved.
:path=/static-assets/excel/content-code-examples/how-to/edit-workbook-metadata.cs
using IronXL;
using System;
WorkBook workBook = WorkBook.Load("sample.xlsx");
// Set author
workBook.Metadata.Author = "Your Name";
// Set comments
workBook.Metadata.Comments = "Monthly report";
// Set title
workBook.Metadata.Title = "July";
// Set keywords
workBook.Metadata.Keywords = "Report";
// Read the creation date of the excel file
DateTime? creationDate = workBook.Metadata.Created;
// Read the last printed date of the excel file
DateTime? printDate = workBook.Metadata.LastPrinted;
workBook.SaveAs("editedMetadata.xlsx");
Imports IronXL
Imports System
Private workBook As WorkBook = WorkBook.Load("sample.xlsx")
' Set author
workBook.Metadata.Author = "Your Name"
' Set comments
workBook.Metadata.Comments = "Monthly report"
' Set title
workBook.Metadata.Title = "July"
' Set keywords
workBook.Metadata.Keywords = "Report"
' Read the creation date of the excel file
Dim creationDate? As DateTime = workBook.Metadata.Created
' Read the last printed date of the excel file
Dim printDate? As DateTime = workBook.Metadata.LastPrinted
workBook.SaveAs("editedMetadata.xlsx")
Accessible Metadata Fields
Not all metadata properties can be edited or changed. Some properties can only be retrieved. Below is a list of the available properties:
Set, Modify, and Retrieve
- Author
- Comments
- LastPrinted
- Keywords and Category
- Created and ModifiedDate
- Subject and Title
Retrieve Only
- ApplicationName
- CustomProperties
- Company
- Manager
- Template