CLI Tool
SheetKit includes a command-line tool for working with Excel (.xlsx) files directly from the terminal. The CLI provides quick access to common workbook operations without writing code.
Installation
Build from source with the cli feature:
cargo install sheetkit --features cliOr build locally:
cargo build --release --package sheetkit --features cliThe binary will be at target/release/sheetkit.
Commands
info
Show workbook information including sheet names, active sheet, and document properties.
sheetkit info report.xlsxExample output:
File: report.xlsx
Sheets: 3
1: Summary (active)
2: Data
3: Charts
Creator: John Smith
Modified: 2025-01-15T10:30:00Zsheets
List all sheet names in the workbook, one per line.
sheetkit sheets report.xlsxExample output:
Summary
Data
ChartsThis is useful for scripting:
for sheet in $(sheetkit sheets report.xlsx); do
sheetkit convert report.xlsx -f csv -o "${sheet}.csv" --sheet "$sheet"
doneread
Read and display sheet data. Defaults to the active sheet with tab-separated output.
# Read the active sheet as a table
sheetkit read report.xlsx
# Read a specific sheet
sheetkit read report.xlsx --sheet Data
# Output as CSV
sheetkit read report.xlsx --format csvOptions:
| Flag | Short | Description |
|---|---|---|
--sheet <name> | -s | Sheet to read (default: active sheet) |
--format <fmt> | -f | Output format: table (default) or csv |
get
Get a single cell value.
sheetkit get report.xlsx Sheet1 A1Returns the cell value to stdout. Empty cells produce no output. Numeric values are displayed without trailing zeros for integers. Boolean values are displayed as TRUE or FALSE.
set
Set a cell value and save to a new file.
sheetkit set report.xlsx Sheet1 A1 "New Title" -o updated.xlsxThe value is automatically interpreted:
TRUE/FALSE(case-insensitive) are stored as booleans.- Valid numbers are stored as numeric values.
- Everything else is stored as a string.
Options:
| Flag | Short | Description |
|---|---|---|
--output <path> | -o | Output file path (required) |
convert
Convert a sheet to another format.
# Convert active sheet to CSV
sheetkit convert report.xlsx -f csv -o output.csv
# Convert a specific sheet
sheetkit convert report.xlsx -f csv -o data.csv --sheet DataOptions:
| Flag | Short | Description |
|---|---|---|
--format <fmt> | -f | Target format: csv (required) |
--output <path> | -o | Output file path (required) |
--sheet <name> | -s | Sheet to convert (default: active sheet) |
Exit Codes
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | Error (invalid file, missing sheet, bad cell reference, etc.) |
Error messages are printed to stderr.
Examples
# Quick inspection of an unknown spreadsheet
sheetkit info data.xlsx
sheetkit sheets data.xlsx
sheetkit read data.xlsx | head -5
# Extract a specific value for use in a script
total=$(sheetkit get data.xlsx Summary B10)
echo "Total: $total"
# Batch update a cell and export
sheetkit set template.xlsx Report A1 "Q4 2025" -o report.xlsx
sheetkit convert report.xlsx -f csv -o report.csv
# Export all sheets to CSV
for sheet in $(sheetkit sheets workbook.xlsx); do
sheetkit convert workbook.xlsx -f csv -o "${sheet}.csv" --sheet "$sheet"
done