DRIT.Spreadsheet 26.7.890

dotnet add package DRIT.Spreadsheet --version 26.7.890
                    
NuGet\Install-Package DRIT.Spreadsheet -Version 26.7.890
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DRIT.Spreadsheet" Version="26.7.890" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DRIT.Spreadsheet" Version="26.7.890" />
                    
Directory.Packages.props
<PackageReference Include="DRIT.Spreadsheet" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DRIT.Spreadsheet --version 26.7.890
                    
#r "nuget: DRIT.Spreadsheet, 26.7.890"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package DRIT.Spreadsheet@26.7.890
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=DRIT.Spreadsheet&version=26.7.890
                    
Install as a Cake Addin
#tool nuget:?package=DRIT.Spreadsheet&version=26.7.890
                    
Install as a Cake Tool

DRIT.Spreadsheet

Pure-Managed .NET Spreadsheet Library

Create, Read, Manipulate, Sign, and Convert Spreadsheet Files

DRIT.Spreadsheet is a pure-managed, cross-platform .NET library for creating, reading, and manipulating spreadsheet documents — XLSX, XLS, XLSB, CSV, and TSV — with full support for a formula calculation engine, charts, pivot tables, tables, conditional formatting, data validation, digital signatures (PKCS#12, XAdES-BES), AES-256 encryption, form controls, VBA macros, and PDF export — without relying on any external software dependencies.

Key Benefits

  • Pure managed C# implementation with minimal NuGet dependencies
  • Consistent rendering results across Windows, Linux, macOS
  • Seamless migration path from GemBox.Spreadsheet and Aspose.Cells
  • Full formula calculation engine with circular-reference detection and iterative calculation
  • XAdES-BES digital signatures and AES-256 (ECMA-376 Agile) encryption
  • Integrated with DRIT.Pdf for PDF export and signing workflows

Cross-Platform Spreadsheet Library

DRIT.Spreadsheet targets .NET Framework 4.8, .NET Standard 2.0, and .NET 6.0, so it runs on:

  • Operating Systems: Windows, Linux, macOS
  • Frameworks: .NET Framework 4.8, .NET Standard 2.0, .NET 6.0
  • Dependencies: System.Drawing.Common; System.Text.Encoding.CodePages (.NET Standard 2.0); System.Security.Cryptography.Xml; System.Memory (.NET Standard 2.0)

Features

Document I/O

  • Create — generate new workbooks from scratch
  • Load/Save — read from and write to file or stream (XLSX, XLS, XLSB, CSV, TSV), with load options (password, warning callback) and cancellation support
  • Workbook properties — built-in document properties (Title, Author, Subject, Keywords, Company) and custom metadata
  • Custom XML parts — persist custom XML and content-type properties

Cells and Data

  • Cell values — read and write all types (string, int, double, bool, DateTime, DateTimeOffset); merged cells and ranges
  • Formulas — calculate almost all Excel functions; shared formulas, array formulas, circular-reference detection, and iterative calculation
  • Find and replace — search text and formulas across workbooks and worksheets; regex and case-sensitive matching with replace options
  • Sorting — multi-condition sort via SortState and SortCondition
  • Filtering — AutoFilter with value, custom, dynamic, and top-10 criteria; advanced filter
  • Data validation — decimal, list, custom, date, time, text-length, and whole-number rules

Formatting

  • Number formatting — built-in and custom number formats via Format.Parse; DBNum patterns
  • Cell formatting — font, alignment, borders, and fill (solid, pattern, gradient)
  • Rich text — inline formatting via RichTextParagraph and RichTextRun
  • Conditional formatting — two/three-color scale, icon set, data bar, above-average, and cell-value rules
  • Themes — workbook theme colors and fonts

Rows and Columns

  • AutoFit — auto-fit row and column dimensions, including merged cells
  • Grouping and outlining — collapsible row/column groups with summary position
  • Sizing and visibility — height/width in points, characters, or pixels; hide/show
  • Insert and delete — insert and delete rows and columns with optional format copy

Worksheets

  • Management — create, copy, delete, move, and hide worksheets
  • View — freeze and split panes; gridlines, headers, scrollbars, zoom, and right-to-left layout
  • Page setup — margins, orientation, paper size, scaling, fit-to-pages, print area, and print titles
  • Headers and footers — text and image in page headers and footers
  • Page breaks — insert and remove page breaks

Tables and Pivot Tables

  • Tables — create and style tables with headers; convert to range; query-table data source
  • Pivot tables — create, refresh, and calculate; row/column/data/page fields; aggregation functions; number formats
  • Slicers — pivot-table slicers with caption, style, and layout

Charts

  • Chart types — Bar, Column, Line, Pie, Scatter, Bubble, Area, and 3-D variants
  • Chart formatting — titles, legends, data labels, axes, gridlines, gap width, series overlap, and 3-D format
  • Chart sheets — dedicated chart sheets with multiple chart objects
  • Sparklines — sparkline groups

Drawing Objects

  • Shapes — text boxes, geometric shapes, and pictures with anchoring and positioning
  • Form controls — button, check box, combo box, list box, radio button, text box, scroll bar, and spinner
  • OLE objects — embed, extract, and refresh OLE objects
  • Hyperlinks — external URLs and internal document references
  • Comments — cell comments with formatting and embedded images
  • Defined names — named ranges and formula definitions

Protection and Security

  • Sheet protection — password protection with granular permission flags; allow-edit ranges; locked cells
  • Workbook protection — lock structure and windows; revision protection; write protection with author
  • Encryption — AES-256 (ECMA-376 Agile) XLSX encryption with password-protected opening
  • Digital signatures — PKCS#12 (PFX) signing; XAdES-BES with qualifying properties and signer role; append signatures; signature validation and removal
  • PDF signing — sign and encrypt exported PDFs via DRIT.Pdf

Macros and Automation

  • VBA macrosVbaProject with modules and password protection

Conversion

  • CSV/TSV — import and export with trim options
  • DataTable integration — import from DataTable, DataView, arrays, and custom objects; export ranges to DataTable
  • JSON — import and export cell ranges as JSON via DataImportExport
  • PDF export — export workbooks to PDF via WorkbookPdfExporter with page setup and print options
  • Markdown — export the active worksheet as a GitHub Flavored Markdown table

Supported File Formats

Format Description Read Write
XLSX Excel 2007+ Spreadsheet ✔️ ✔️
XLS Legacy Excel Binary Format ✔️ Preservation-only
XLSB Excel Binary Workbook ✔️ ✔️
CSV Comma-Separated Values ✔️ ✔️
TSV Tab-Separated Values ✔️ ✔️
PDF Portable Document Format ✔️
Markdown GitHub Flavored Markdown Table ✔️
JSON JSON Data (import/export) ✔️ ✔️

PDF export and signing are provided via the integrated DRIT.Pdf companion.


Installation

1. Install via NuGet

  • Open Microsoft Visual Studio and the NuGet package manager
  • Search for "DRIT.Spreadsheet"
  • Click Install to download and reference it in your project

2. Install via Package Manager Console

Install-Package DRIT.Spreadsheet

3. Install via .NET CLI

dotnet add package DRIT.Spreadsheet

Code Examples

Create a Spreadsheet

using DRIT.Spreadsheet;

// Initialize a new workbook
var workbook = new Workbook();
var worksheet = workbook.Worksheets[0];

// Set cell values
worksheet.Cells["A1"].Value = "Product";
worksheet.Cells["B1"].Value = "Price";
worksheet.Cells["A2"].Value = "NebulaCore Server";
worksheet.Cells["B2"].Value = 4899.00;

// Save the workbook
workbook.SaveAs("output.xlsx");

Load and Iterate Data

using DRIT.Spreadsheet;

// Load an existing workbook
var workbook = Workbook.Load("input.xlsx");
var worksheet = workbook.Worksheets[0];

// Iterate all cells in the used range
foreach (var cell in worksheet.UsedRange.GetAllCells())
{
    Console.WriteLine($"[{cell.Row.Index},{cell.Column.Index}]: {cell.Value}");
}

Apply Formatting

using DRIT.Spreadsheet;

var workbook = new Workbook();
var worksheet = workbook.Worksheets[0];

// Number formatting
worksheet.Cells["A1"].Value = 1234.56;
worksheet.Cells["A1"].Format = Format.Parse("#,##0.00");

// Rich text formatting
var richText = new RichTextParagraph();
richText.Runs.Add(new RichTextRun("Bold"));
var italicRun = new RichTextRun(" and ");
italicRun.Italic = true;
richText.Runs.Add(italicRun);
richText.Runs.Add(new RichTextRun("Italic"));
worksheet.Cells["B1"].RichText = richText;

workbook.SaveAs("formatted.xlsx");

Create a Chart

using DRIT.Spreadsheet;
using DRIT.Spreadsheet.Charts;

var workbook = new Workbook();
var worksheet = workbook.Worksheets[0];

// Add sample data
worksheet.Cells["A1"].Value = "Month";
worksheet.Cells["A2"].Value = "Jan";
worksheet.Cells["A3"].Value = "Feb";
worksheet.Cells["B1"].Value = "Sales";
worksheet.Cells["B2"].Value = 1000;
worksheet.Cells["B3"].Value = 1500;

// Create chart
var chart = worksheet.Charts.Add<BarChart>("D2");
chart.DataSource = "Sheet1!$A$1:$B$3";
chart.AddTitle();
chart.AddLegend();

workbook.SaveAs("chart.xlsx");

Apply Conditional Formatting

using DRIT.Spreadsheet;

var workbook = new Workbook();
var worksheet = workbook.Worksheets[0];

// Add sample data
for (int i = 0; i < 10; i++)
    worksheet.Cells[i, 0].Value = i * 100;

// Two-color scale
worksheet.ConditionalFormattings.AddTwoColorScale(
    "A1:A10", SpreadsheetColor.Red, SpreadsheetColor.Green);

// Data bar
worksheet.ConditionalFormattings.AddDataBar(
    "B1:B10", SpreadsheetColor.Blue);

workbook.SaveAs("conditional.xlsx");

Data Validation

using DRIT.Spreadsheet;

var workbook = new Workbook();
var worksheet = workbook.Worksheets[0];

// Decimal validation (0–100)
worksheet.DataValidations.AddDecimal(
    "A1:A10", DataValidationOperator.Between, 0, 100);

// List validation
worksheet.DataValidations.AddList(
    "B1:B10", "Option1,Option2,Option3");

// Custom validation
worksheet.DataValidations.AddCustom(
    "C1:C10", "=MOD(C1,2)=0");

workbook.SaveAs("validation.xlsx");

Find and Replace

using DRIT.Spreadsheet;

var workbook = Workbook.Load("input.xlsx");

// Find all occurrences
var matches = workbook.FindAll(new FindArguments { FindWhat = "old value" });
Console.WriteLine($"Found {matches.Count()} matches");

// Replace across workbook
workbook.ReplaceAll(new ReplaceArguments
{
    FindWhat = "old value",
    ReplaceWith = "new value"
});

workbook.SaveAs("updated.xlsx");

Export to PDF

using DRIT.Spreadsheet;

var workbook = Workbook.Load("input.xlsx");

// Export entire workbook to PDF
workbook.SaveAsPdf("output.pdf");

// Export a single worksheet
workbook.SaveAsPdf("sheet1.pdf", new WorkbookPdfSaveOptions
{
    SheetIndexes = new[] { 0 }
});

Protect a Worksheet

using DRIT.Spreadsheet;

var workbook = new Workbook();
var worksheet = workbook.Worksheets[0];

// Add data
worksheet.Cells["A1"].Value = "Protected Content";

// Protect with password
worksheet.Protection.Protect("password123");
worksheet.Protection.InsertRows = false;
worksheet.Protection.DeleteColumns = false;

workbook.SaveAs("protected.xlsx");

Encrypt a Workbook

using DRIT.Spreadsheet;

var workbook = new Workbook();
workbook.Worksheets[0].Cells["A1"].Value = "secret";

// Save with AES-256 encryption
workbook.SaveAs("encrypted.xlsx", new XlsxSaveOptions
{
    EncryptionMode = XlsxEncryptionMode.Ecma376Agile,
    Password = "open-password"
});

// Open with the correct password
var loaded = Workbook.Load("encrypted.xlsx",
    new XlsxLoadOptions { Password = "open-password" });

Add a Digital Signature

using System.Security.Cryptography.X509Certificates;
using DRIT.Spreadsheet;

var workbook = new Workbook();
workbook.Worksheets[0].Cells["A1"].Value = "signed";

// Sign with a PFX certificate (XAdES-BES)
var certificate = new X509Certificate2("certificate.pfx", "password");
workbook.SaveAsSigned("signed.xlsx", new XlsxDigitalSignatureSaveOptions
{
    Certificate = certificate,
    SignerRole = "Author"
});

// Validate on reload
var signatures = Workbook.ListDigitalSignatures("signed.xlsx");
Console.WriteLine($"Signatures: {signatures.Count}");

System Requirements

  • Target Frameworks: .NET Framework 4.8, .NET Standard 2.0, .NET 6.0
  • Dependencies: System.Drawing.Common; System.Text.Encoding.CodePages (.NET Standard 2.0); System.Security.Cryptography.Xml; System.Memory (.NET Standard 2.0)
  • Optional: DRIT.Pdf for PDF export and signing (bundled)

Documentation


© 2021-2026 DR-IT Ltd. All Rights Reserved.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 is compatible.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
26.7.890 101 7/31/2026
25.10.1 282 10/18/2025
1.2.21149.1 728 5/30/2021
1.1.21008.2 689 1/8/2021
1.0.20336.4 627 12/1/2020
0.10.20316.3-beta 546 11/11/2020
0.9.20286.4-beta 531 10/12/2020
0.8.20252.1-alpha 548 9/8/2020
0.8.20247.16-alpha 582 9/4/2020

-.NET 6.0 support added.