OpenStandardLibrary 1.0.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package OpenStandardLibrary --version 1.0.3
                    
NuGet\Install-Package OpenStandardLibrary -Version 1.0.3
                    
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="OpenStandardLibrary" Version="1.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="OpenStandardLibrary" Version="1.0.3" />
                    
Directory.Packages.props
<PackageReference Include="OpenStandardLibrary" />
                    
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 OpenStandardLibrary --version 1.0.3
                    
#r "nuget: OpenStandardLibrary, 1.0.3"
                    
#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 OpenStandardLibrary@1.0.3
                    
#: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=OpenStandardLibrary&version=1.0.3
                    
Install as a Cake Addin
#tool nuget:?package=OpenStandardLibrary&version=1.0.3
                    
Install as a Cake Tool

Open Standard Library

A .NET library for reading and creating spreadsheet files in ODS, XLSX, and delimited formats (CSV, TSV, pipe-delimited). No external dependencies — just pure .NET.

NuGet

Supported Formats

Format Generate Import
ODS (OpenDocument Spreadsheet) Yes Yes
XLSX (Office Open XML) Yes Yes
Delimited (comma, tab, pipe, ASCII) Yes Yes

Features

  • Multi-sheet workbooks — create and import workbooks with multiple named sheets
  • Cell value types — String, Float, Boolean, DateTime, and Int64
  • Cell styling — bold, italic, underline, font color/name/size, background color, borders (thin/medium/thick with color per edge), and text wrapping
  • Column widths — manual SetColumnWidth() or automatic AutoFitColumns() with min/max constraints
  • Freeze panes — freeze rows and/or columns with FreezeRows and FreezeColumns
  • Auto-filters — SetAutoFilter() for the full range or a custom range
  • Header row detection — HasHeaderRow, HeaderNames, and GetColumn(string) for column-name-based access. Auto-detected on XLSX/ODS import when freeze panes or auto-filters are present
  • Streaming CSV reader — ReadCsvRowsAsync() reads rows one at a time via IAsyncEnumerable with optional header detection and row limit
  • File encoding options — UTF-8 (default), ASCII, Unicode (UTF-16), and UTF-32 for delimited files
  • Epoch conversion — FromEpochSeconds(), FromEpochMilliseconds(), ToEpochSeconds(), ToEpochMilliseconds() extension methods on cells
  • Formulas — set formula expressions on cells
  • File validation — SpreadsheetValidator checks that XLSX, ODS, and delimited files are well-formed without importing them, returning structured errors and warnings (sheet, cell, row, rule code, message). Useful for vetting files produced by LLMs or other tools before they reach users
  • Dependency injection — implements ISpreadsheet with IDisposable/IAsyncDisposable

Installation

dotnet add package OpenStandardLibrary

Quick Start

Generate an XLSX file

using OoxSpreadsheet;
using OslSpreadsheet.Models;

using var spreadsheet = new Spreadsheet();
var sheet = spreadsheet.Workbook.AddSheet("Data");

sheet.AddCell(1, 1, "Name");
sheet.AddCell(1, 2, "Score");
sheet.AddCell(2, 1, "Alice");
sheet.AddCell(2, 2, "95.5", CellValueType.Float);

var bytes = await spreadsheet.GenerateXlsxFileAsync();
await File.WriteAllBytesAsync("output.xlsx", bytes);

Import and read by column name

using var spreadsheet = new Spreadsheet();
var workbook = await spreadsheet.ImportXlsxFileAsync(File.ReadAllBytes("input.xlsx"));
var sheet = workbook.Sheets[0];

// HasHeaderRow is auto-detected from freeze panes or auto-filters
if (sheet.HasHeaderRow)
{
    var names = sheet.GetColumn("Name");
    foreach (var cell in names)
        Console.WriteLine(cell.Value);
}

Validate a file

using OslSpreadsheet.Validation;

var result = SpreadsheetValidator.Validate(File.ReadAllBytes("report.xlsx"), "report.xlsx");

if (!result.IsValid)
{
    foreach (var issue in result.Errors)
        Console.WriteLine($"{issue.Code} {issue.Sheet}!{issue.Cell}: {issue.Message}");
}

See Validating Files for details.

Stream CSV rows

using var spreadsheet = new Spreadsheet();
using var stream = File.OpenRead("large-file.csv");

await foreach (var row in spreadsheet.ReadCsvRowsAsync(stream, hasHeaderRow: true, rowLimit: 100))
{
    Console.WriteLine(string.Join(", ", row));
}

// Headers are available after iteration
Console.WriteLine($"Columns: {string.Join(", ", spreadsheet.CsvHeaders!)}");

Cell styling

var cell = sheet.AddCell(1, 1, "Header");
cell.Style = new CellStyle
{
    Bold = true,
    FontColor = "#FFFFFF",
    BackgroundColor = "#2196F3",
    BorderBottom = new CellBorder { Style = BorderStyle.Medium, Color = "#1565C0" },
    WrapText = true
};

Epoch conversion

var cell = sheet.AddCell(1, 1, "1747650600");
cell.FromEpochSeconds(); // Value becomes "2025-05-19T10:30:00", ValueType becomes DateTime

// Or convert back
cell.ToEpochSeconds(); // Value becomes "1747650600", ValueType becomes Int64

Supported Frameworks

  • .NET 8.0
  • .NET 9.0
  • .NET 10.0

Disclaimer

This software is provided "as is", without warranty of any kind. Use at your own risk. See the LICENSE file for full terms.

License

MIT

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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 is compatible.  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 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

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
1.2.0 127 11/1/2026
1.1.0 96 10/11/2026
1.0.3 87 10/6/2026
1.0.2 550 5/20/2026
1.0.1 210 5/1/2026
1.0.0 98 4/30/2026