Skip to content

cosmoscalibur/sheetrs

Repository files navigation

SheetRS Suite

The SheetRS Suite is a high-performance toolkit for processing, linting, and manipulating spreadsheets (XLSX and ODS). Written in Rust, it is designed for speed, safety, and ease of integration into CI/CD pipelines.

The suite consists of three specialized CLI tools:

  • sheetlint: Advanced spreadsheet linter with hierarchical rule enforcement.
  • sheetstats: Detailed statistics and dependency analysis for workbooks.
  • sheetcli: General-purpose spreadsheet operations (convert, modify, repair).

Prerequisites

  • Rust ≥ 1.88 (edition 2024)

Installation

From Source

# Clone the repository
git clone https://github.com/cosmoscalibur/sheetrs.git
cd sheetrs

# Install all tools
cargo install --path sheetlint
cargo install --path sheetstats
cargo install --path sheetcli

Development

# Build the workspace
cargo build

# Run all tests
cargo test

# Lint
cargo clippy -- -D warnings

# Format check
cargo fmt --check

No environment variables are required. Configuration is via sheetlint.toml.

Project Structure

sheetrs/
├── sheetrs/        # Core library (parsers, rules, config, writer)
├── sheetlint/      # Linter CLI
├── sheetstats/     # Statistics CLI
├── sheetcli/       # Manipulation CLI
├── sheetrs-wasm/   # WASM bindings for browser use
├── docs/           # Documentation index + WASM demo
├── tests/          # Shared test assets (minimal_test.xlsx/.ods)
├── scripts/        # Benchmark scripts
└── Cargo.toml      # Workspace configuration

Tools Overview

1. sheetlint

A comprehensive linter for detecting errors, security issues, performance bottlenecks, and style violations.

Features:

  • Hierarchical Reporting: Violations grouped by file → sheet → cell.
  • Configurable: TOML-based configuration with global and per-sheet overrides.
  • Formats: Support for JSON and text output.

Usage:

# Lint a file
sheetlint workbook.xlsx

# Lint with custom config
sheetlint workbook.xlsx --config sheetlint.toml

# CI/CD mode (JSON output) (:warning: experimental/unstable)
sheetlint workbook.xlsx --format json > report.json

Example Rules:

  • ERR102: Excel error cells (#DIV/0!, etc.)
  • EXT802: External workbook references
  • CPX503: Excessive conditional formatting
  • DATA703: Inconsistent date formats
  • CPX501: Excessive sheet counts

See the rule reference for the full, authoritative catalog.

2. sheetstats

Provides deep insights into workbook structure, complexity, and dependencies.

Features:

  • General Stats: Counts of sheets, cells, formulas, values.
  • Dependencies: Builds a graph of inter-sheet dependencies (upcoming).

Usage:

# Get general stats
sheetstats workbook.xlsx

3. sheetcli

A swiss-army knife for spreadsheet manipulation.

Features:

  • Modification: Remove sheets, delete named ranges.

Usage:

# Remove sensitive sheets and save to new file
sheetcli input.xlsx --remove-sheets "Secrets" "Admin" --output cleaned.xlsx

# Remove named ranges
sheetcli input.xlsx --remove-ranges "OldRange" --output cleaned.xlsx

Roadmap

  • Error Propagation Tracing: Future versions may trace only the root cause error cell rather than reporting all affected cells.
  • Python Bindings: PyO3 bindings for direct integration with Python data workflows.
  • Windows & WASM: Windows support is likely functional but untested. WASM target for browser-based linting is planned.
  • Performance Review: Continuous optimization for large workbooks (>1M cells).

Documentation

License

MIT

About

Spreadsheet (Excel & LibreOffice) open source tools written in Rust. Lint, analyse, stats and query.

Topics

Resources

Contributing

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages