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.

Get started with IronXL

Start using IronXL in your project today with a free trial.

First Step:
green arrow pointer


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")
$vbLabelText   $csharpLabel
Metadata

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

Frequently Asked Questions

What is workbook metadata in Excel?

Workbook metadata in Excel includes information such as the title, author, subject, keywords, creation date, modification date, and other relevant details that provide context and help in organizing spreadsheets.

How can I edit workbook metadata without additional software?

You can edit workbook metadata by utilizing the IronXL library in C#. This library allows you to access and modify metadata properties like author, title, and subject directly.

What are the steps to edit workbook metadata?

To edit workbook metadata using IronXL, download the library, load or create a spreadsheet, access the Metadata property to modify details, and then save the spreadsheet with updated metadata.

Can you provide a code example for setting the author property in workbook metadata?

Yes, you can set the author property by using the following code: `workBook.Metadata.Author = "Your Name";` This updates the author field in the workbook metadata using IronXL.

What metadata properties can be modified?

Using IronXL, you can modify metadata properties such as Author, Comments, LastPrinted, Keywords, Category, Created and ModifiedDate, Subject, and Title.

Are there any metadata properties that can only be retrieved but not modified?

Yes, some metadata properties like ApplicationName, CustomProperties, Company, Manager, and Template can only be retrieved and not modified using IronXL.

What is the advantage of editing workbook metadata?

Editing workbook metadata provides better context, helps in organizing and categorizing spreadsheets, and simplifies file search and management, especially with multiple files.

Does the library support creating a new workbook while editing metadata?

Yes, IronXL supports both loading an existing workbook and creating a new one, allowing you to edit metadata in both scenarios.

How do I save a workbook after editing its metadata?

After editing the metadata, you can save the workbook using the `SaveAs` method. For example: `workBook.SaveAs("updatedWorkbook.xlsx");`

Where can I download the library to edit workbook metadata?

The IronXL library can be downloaded from the NuGet package repository at https://nuget.org/packages/IronXL.Excel/

Chaknith related to Retrieve Only
Software Engineer
Chaknith is the Sherlock Holmes of developers. It first occurred to him he might have a future in software engineering, when he was doing code challenges for fun. His focus is on IronXL and IronBarcode, but he takes pride in helping customers with every product. Chaknith leverages his knowledge from talking directly with customers, to help further improve the products themselves. His anecdotal feedback goes beyond Jira tickets and supports product development, documentation and marketing, to improve customer’s overall experience.When he isn’t in the office, he can be found learning about machine learning, coding and hiking.