SheetCompressor 0.1.1

dotnet add package SheetCompressor --version 0.1.1
                    
NuGet\Install-Package SheetCompressor -Version 0.1.1
                    
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="SheetCompressor" Version="0.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SheetCompressor" Version="0.1.1" />
                    
Directory.Packages.props
<PackageReference Include="SheetCompressor" />
                    
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 SheetCompressor --version 0.1.1
                    
#r "nuget: SheetCompressor, 0.1.1"
                    
#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 SheetCompressor@0.1.1
                    
#: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=SheetCompressor&version=0.1.1
                    
Install as a Cake Addin
#tool nuget:?package=SheetCompressor&version=0.1.1
                    
Install as a Cake Tool

SheetCompressor

Independent C# implementation of the SheetCompressor encoding from the SpreadsheetLLM paper (Dong et al., Microsoft, 2024). Turns a spreadsheet grid into compact, LLM-friendly text — three interchangeable encodings plus token estimates — and makes no LLM calls itself.

Independent, community implementation. Not affiliated with or endorsed by Microsoft. Part of the multi-language sheet-compressor project.

Install

dotnet add package SheetCompressor

Usage

using SheetCompressor;

var grid = new Grid
{
    Origin = new Origin(1, 1),
    Rows = new IReadOnlyList<string>[]
    {
        new[] { "Name", "Qty", "Price" },
        new[] { "Apple", "3", "1.50" },
    },
};

var result = Compressor.Compress(grid);
Console.WriteLine(result.Encodings.Anchor.String);          // the LLM-ready text
Console.WriteLine($"{result.Encodings.Anchor.TokenEstimate} vs {result.RawBaseline.TokenEstimate}");

Each result carries three encodings — Anchor, InvertedIndex, FormatAggregation — every one with a .String, a .Json, and a .TokenEstimate, plus RawBaseline and any Charts. Per-encoding reader prompt templates are available via PromptsLoader.Instance and ship with the package.

For reading .xlsx files, add the optional SheetCompressor.Xlsx package.

The three encodings

The same sparse two-table sheet, in each encoding (.String shown; each group also has .Json and .TokenEstimate). Raw baseline 100 tokens → 80 / 77 / 23:

# Encodings.Anchor.String  — addresses + values, empty rows dropped
A1,Product|B1,Q1|C1,Q2|D1,Q3|E1,Q4
A2,Apples|B2,100|C2,150|D2,200|E2,120
A15,Region|B15,Cost|C15,Margin|D15,Profit|E15,Status
A16,North|B16,500|C16,0.15|D16,75|E16,good

# Encodings.InvertedIndex.String  — value → cell(s); repeats collapse (B4|D18,60)
A1,Product
B4|D18,60
E16|E18,good

# Encodings.FormatAggregation.String  — values → type over ranges
IntNum: B2:E4,B16:B18,D16:D18
FloatNum: C16:C18
Text: A1:E1,A2:A4,A15:E15,A16:A18,E16:E18

See the project README for the complete strings.

Prompts — read the output with an LLM

The shared prompt templates ship with the package and load via PromptsLoader.Instance: reader explainers (PromptsLoader.Instance.Readers.Anchor / .InvertedIndex / .FormatAggregation) that teach a model to decode each encoding, task templates (PromptsLoader.Instance.Tasks.SheetQA / .CellValueLookup / .TableRegionDetection) with {ENCODING} / {ADDRESS} / {QUESTION} placeholders, and .Snippets.ChartDescriptor. The library makes no LLM calls — assemble the messages and send them to any chat model:

var result = Compressor.Compress(grid);

// reader explainer → system prompt; task template with placeholders filled → user message
var system = PromptsLoader.Instance.Readers.Anchor;
var user = PromptsLoader.Instance.Tasks.SheetQA
    .Replace("{ENCODING}", result.Encodings.Anchor.String)
    .Replace("{QUESTION}", "Which region had the highest profit?");

// Send { system, user } to your chat model (e.g. the Anthropic .NET SDK) and read the reply.

License

MIT. The SheetCompressor algorithm originates from the SpreadsheetLLM paper, credited above.

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on SheetCompressor:

Package Downloads
SheetCompressor.Xlsx

Optional .xlsx adapter for SheetCompressor (ClosedXML): reads a single sheet — grid, origin, per-cell data type, and embedded chart descriptors — into the SheetCompressor.Grid shape. Not affiliated with Microsoft.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.1 153 6/18/2026
0.1.0 131 6/18/2026

Docs: encoding + LLM prompt-usage examples. https://github.com/mythopoeic/sheet-compressor/releases/tag/v0.1.1