Skip to main content
xlgrep

Usage • Key features • Installation • AI agents • Development

xlgrep is grep for spreadsheets: search cell values and formulas
across folders of .xlsx, .xlsm, .xlsb, .xls and .ods files. Read-only.

xlgrep smith -i: matches grouped by workbook, with Excel-style refs like 'Q3 Sales'!B6 and the match highlighted

Usage

xlgrep smith -i                  # current folder, recursive, case-insensitive
xlgrep "O'Brien" C:\dir -F       # literal text
xlgrep smith -w                  # whole word (-wF "C++" works too)
xlgrep smith -x                  # whole cell
xlgrep smith --row               # print each matching row in full
xlgrep smith --sheet Contacts    # only that sheet
xlgrep VLOOKUP --formulas -l     # workbooks whose formulas use VLOOKUP
xlgrep smith -c                  # hit count per file (rows with --row)
xlgrep smith -m 5                # stop each file after 5 hits
xlgrep smith --json --row        # JSON Lines for scripts and agents
xlgrep smith --json | head -50   # first 50 hits overall; the search stops early

Run xlgrep --help for the full option list.

Key features

Click to learn more.

Every common spreadsheet format

.xlsx, .xlsm, .xlsb, .xls and .ods, plus .xltx/.xltm templates, read with calamine. No Excel or LibreOffice needed. Values print as Excel shows them where calamine allows: TRUE, 2024-03-05, 14:30:00, 36:05:07 durations.

grep-style matching

Patterns are regexes; -F for literal text, -i to ignore case, -w for whole words (-wF "C++" works too), -x to match the whole cell. --sheet limits the search to sheets with that name (case-insensitive). --formulas searches formula text instead of values, as Excel shows it: =XLOOKUP(A1,B:B,C:C), not the _xlfn.XLOOKUP stored in the file.

Results you can jump to

In a terminal, hits are grouped under each file with Excel-style refs like 'Q3 Sales'!B7, which paste straight into Excel's Name Box. Output is colored (NO_COLOR disables it) and cut to the window width. --row prints each matching row in full instead of single cells.

Built for scripts and agents

AI agents can't read spreadsheets with their usual tools: .xlsx files are compressed, so grep, rg and file readers find nothing inside them, and agents fall back to writing openpyxl or pandas scripts. xlgrep is one command instead, with no Python environment.

--json prints JSON Lines: {"file","sheet","cell","value"} per hit, plus "row_values": {"A": …, "C": …} keyed by column with --row (formula cells only with --formulas). Only matching cells reach the agent's context, not whole sheets, and -m, -l, -c and | head cap how much comes back; closing the pipe early stops the search. Every hit names its sheet and cell, so a person can check it in Excel.

Exit code 0 if anything matched, 1 if not, 2 on an error: bad arguments, a --sheet name no file has, or anything that couldn't be searched. Matches elsewhere still print and stderr names each skipped file and why, so an agent can tell "not there" from "couldn't look". xlgrep is read-only and won't download OneDrive files unless asked, so it's safe to let an agent run it without approval. See Using with AI agents.

Fast

Files are read in parallel and output stays in file order: 400 files x 2000 rows take 0.25 s instead of 1.56 s read one at a time. .xlsx and .xlsb sheets are streamed, not loaded whole, and --sheet skips reading the others.

Safe on OneDrive

OneDrive online-only files are skipped by default, so a search never mass-downloads your OneDrive. --download includes them. Skipped OneDrive files aren't errors.

Robust against bad files and bad cells

Unreadable files and folders (password-protected, corrupt, access denied, OneDrive offline) are skipped with a reason, and the exit code says so; so is a file that crashes the reader. Control characters in cells print escaped (\n, \u{1b}), so a cell can't break lines or inject terminal codes.

Non-features

xlgrep only reads. It doesn't replace or edit cells.
Numbers print raw (51200, not $51,200.00); number formats aren't applied.
The human-readable output is for reading. Anything that parses output should use --json.

Installation

Windows, with Scoop:

scoop bucket add xlgrep https://github.com/DavisMcCracken/xlgrep
scoop install xlgrep

Windows, macOS or Linux, from PyPI with uv or pipx. The wheel holds the same binary; there's no Python code.

uv tool install xlgrep        # or: pipx install xlgrep

uvx xlgrep … runs it without installing.

Or download the zip (Windows) or tar.gz (Linux x86_64/ARM, static, any distro) from Releases, unpack, and put xlgrep on your PATH. Each release has a SHA256SUMS file to check the download.

Or with Cargo:

cargo install xlgrep --locked

Using with AI agents

Paste this into your agent instructions (AGENTS.md, CLAUDE.md, …):

To search or read .xlsx/.xlsm/.xlsb/.xls/.ods files, use `xlgrep` instead of writing
openpyxl/pandas scripts (if it isn't installed, `uvx xlgrep …` runs it). Use `--json` when
parsing output: `{"file","sheet","cell","value"}` per hit; add `--row` for the whole matching row.
Keep output small: `-m 20` per file, `| head -N` overall; `-l` (matching files) and `-c` (hits per
file) print plain lines, not JSON.
Examples: `xlgrep "smith" -i --json -m 20`, `xlgrep VLOOKUP --formulas -l`,
`xlgrep . book.xlsx --sheet Sheet1 --json | head -100` (dump a sheet's non-empty cells).
Numbers are raw (search `51200`, not `$51,200.00`). Exit 1 = no match; exit 2 = something
couldn't be searched: read stderr before concluding a value isn't there (it also lists skipped
OneDrive online-only files, which don't change the exit code).
Don't pass `--download` (it downloads OneDrive online-only files) without asking.

Development

ci

Build and run

cargo run --release -- <xlgrep args>

Run all tests

cargo test

On Windows without admin/Visual Studio, use the GNU toolchain: scoop install rustup-gnu.

Releasing

Bump version in Cargo.toml, commit, then git tag v0.2.0 && git push --tags. The release workflow checks the tag matches Cargo.toml, builds and tests, publishes the binaries with SHA256SUMS, updates the Scoop manifest (bucket/xlgrep.json) and publishes to crates.io and PyPI (wheels built with maturin, holding the same binary). Running it by hand from the Actions tab builds and tests without publishing.

License

MIT or Apache-2.0, at your option.

Metadata

Release files for xlgrep 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for xlgrep 0.3.0
File
xlgrep-0.3.0-py3-none-win_arm64.whl Python 3 none Windows ARM64 Details
xlgrep-0.3.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
xlgrep-0.3.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64 Details
xlgrep-0.3.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl Python 3 none Linux glibc 2.17+ ARM64 Details
xlgrep-0.3.0-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl Python 3 none macOS 11.0+ ARM64, macOS 10.12+ universal2 (ARM64, x86-64), macOS 10.12+ x86-64 Details

Total release size: 8.3 MB

Release files / xlgrep-0.3.0-py3-none-win_arm64.whl

Download URL xlgrep-0.3.0-py3-none-win_arm64.whl
Size 1.3 MB
Tags Python 3 Windows ARM64
SHA-256 checksum
How to use checksums
0542f792c185a1526e1c86571a8c1f801d3c252876ed5ae9d294c67a57f0fd05
BLAKE2b-256 checksum
How to use checksums
bd7c28cf0c47cc533a4f765f5bcac370ff25d650b1ea022713ff800df488b404
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 3, 2026.

Transparency log

Release files / xlgrep-0.3.0-py3-none-win_amd64.whl

Download URL xlgrep-0.3.0-py3-none-win_amd64.whl
Size 1.4 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
bccc3de7dc4e2ddde7927a589f829bed9195a30411bd6dfc9f6a7f8543e372df
BLAKE2b-256 checksum
How to use checksums
9079efd57b8b0af381bed76e6e23caeca55f5bc343d4c49800cc249a45b0ad56
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 3, 2026.

Transparency log

Release files / xlgrep-0.3.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl

Download URL xlgrep-0.3.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Size 1.5 MB
Tags Linux glibc 2.17+ x86-64 Python 3
SHA-256 checksum
How to use checksums
4c27e95a75b21dd2bfa0ff2c3a5d0444f11259aa97d45b924d3eeb09a28471b8
BLAKE2b-256 checksum
How to use checksums
7de1e82f2b78977964978d0f7b3118015216b2ae1ad4f2bbcbe8e2746be045f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 3, 2026.

Transparency log

Release files / xlgrep-0.3.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl

Download URL xlgrep-0.3.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Size 1.4 MB
Tags Linux glibc 2.17+ ARM64 Python 3
SHA-256 checksum
How to use checksums
2d0e1b9712143739b9020d01527fe2bc92d75839918f355cfce9340d1ad9e102
BLAKE2b-256 checksum
How to use checksums
7105c3e1ef27aa4f8b6d58f098c8f60dc2aef9de8152afbea8caa7e4be184f37
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 3, 2026.

Transparency log

Release files / xlgrep-0.3.0-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl

Download URL xlgrep-0.3.0-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Size 2.7 MB
Tags Python 3 macOS 10.12+ universal2 (ARM64, x86-64) macOS 10.12+ x86-64 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
88d7f48cc13bfda6e2174e39ddba1063a5e10dbcdab4b3de44831bf124200563
BLAKE2b-256 checksum
How to use checksums
6dbe0cedfc7db9afa7f96ad6041edf296f8a921f3092b69de599532e7567e371
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 3, 2026.

Transparency log

Release history Release notifications | RSS feed

0.5.0

5 release files

0.4.0

5 release files

This release

0.3.0 This release

5 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page