datacell
A fast, unified CLI tool for spreadsheet and columnar data manipulation.
Features
- Multi-format support: CSV, XLSX, XLS, ODS, Parquet, Avro
- Excel-like formulas: SUM, AVERAGE, VLOOKUP, IF, and more
- Data operations: sort, filter, dedupe, transpose, join, groupby
- Convert between formats: One command for any format conversion
- Output options: CSV, JSON, Markdown
- MCP server: For AI assistant integration
Installation
# From source
# Using cargo
Quick Start
# Convert formats
# Apply formula
# Filter and sort
# Output as JSON
Common Commands
Read & Write
# Read any format
# Read with format conversion
# Write to any format
Convert Formats
Data Operations
# Sort
# Filter
# Remove duplicates
# Transpose
# Find and replace
Pandas-Style Operations
# First/last rows
# Select columns
# Summary statistics
# Group and aggregate
# Join files
# Fill/drop missing values
Formula Reference
| Formula | Description |
|---|---|
SUM(A1:A10) |
Sum of range |
AVERAGE(A1:A10) |
Average of range |
MIN(A1:A10) / MAX(A1:A10) |
Min/Max values |
COUNT(A1:A10) |
Count of cells |
IF(A1>10, "High", "Low") |
Conditional logic |
VLOOKUP(2, A1:C10, 3) |
Lookup value |
CONCAT(A1, " ", B1) |
String concatenation |
ROUND(A1, 2) |
Round to decimals |
ABS(A1) |
Absolute value |
LEN(A1) |
Text length |
Shell Completions
Configuration
Generate a config file with default options:
Example .datacell.toml:
[]
= true
= "4472C4"
= true
= true
[]
= "csv"
= true
Custom XLSX Writer
datacell generates Excel files using a from-scratch XLSX writer — no external Excel writing library needed. The writer produces Office Open XML (OOXML) files directly as ZIP archives containing XML, validated against the ECMA-376 standard.
Why Build From Scratch?
We tried several existing Rust crates for XLSX writing and ran into issues:
| Approach | Issue |
|---|---|
rust_xlsxwriter |
Worked well initially, but added a heavy dependency tree and had version compatibility friction with the zip crate |
simple_excel_writer |
Limited feature set, no formula support |
xlsxwriter (C bindings) |
Requires system-level C library, complicates cross-compilation |
Building our own writer using just the zip crate gave us full control over the XML output, a smaller dependency footprint, and the ability to fix compatibility issues directly. We've since implemented charts, sparklines, conditional formatting, and streaming — all as hand-written OOXML markup.
What It Supports
- Multiple sheets with name validation
- Cell types: String, Number, Formula, Empty
- Column widths (auto-fit and manual)
- Freeze headers (frozen top row)
- Auto-filter for table columns
- Basic styling (bold headers, alignment, borders, fills)
- Charts — Bar, column, line, area, pie, scatter, doughnut with custom colors, legends, axis titles
- Sparklines — Line, column, win/loss in-cell mini charts with optional markers
- Conditional formatting — Color scales, data bars, icon sets, formula-based, cell-value rules
- Streaming writer —
StreamingXlsxWriterfor row-by-row writing of large files - CSV injection protection —
sanitize_csv_value()for safe CSV output - Proper OOXML structure — opens in Excel, Numbers, LibreOffice, Google Sheets
Usage
# Convert CSV to XLSX
# Export with styled headers, freeze panes, and auto-filter
# Generate a chart
# Write formulas to XLSX
// Basic XLSX writing
use ;
let mut writer = new;
writer.add_sheet?;
let mut header = new;
header.add_string;
header.add_string;
writer.add_row;
let mut row = new;
row.add_string;
row.add_number;
writer.add_row;
let file = create?;
writer.save?;
// Chart generation
use ;
let handler = new;
let data = vec!;
let config = ChartConfig ;
handler.write_with_chart?;
// Streaming large files
use StreamingXlsxWriter;
let mut writer = create?;
writer.write_row?;
for i in 0..100_000
writer.finish?;
// CSV injection protection
use ;
assert_eq!; // neutralized
let handler = CsvHandler;
handler.write_records_safe?;
Current Limitations
- Merged cells — not yet implemented
- Data validation dropdowns — not yet implemented
- Pivot tables — not yet implemented
- Rich text within cells — not supported
MCP Server
Start the MCP server for AI assistant integration: