Spreadsheet & JSON Query Engine for AI Agents
Pricing
from $3.00 / 1,000 query inlines
Spreadsheet & JSON Query Engine for AI Agents
Profile, filter, aggregate or SQL-query CSV, Excel, JSON and NDJSON (inline or from a URL) and diff two tables — without loading the whole file into a language model. Exact counts, sandboxed read-only SQL, and bounded results. $0.003 inline or $0.005 per URL.
Pricing
from $3.00 / 1,000 query inlines
Rating
0.0
(0)
Developer
Chris Day
Maintained by CommunityActor stats
0
Bookmarked
1
Total users
0
Monthly active users
2 days ago
Last modified
Categories
Features
Share
Give this Actor a CSV, TSV, Excel (.xlsx), JSON or NDJSON file — inline or from a public URL — and it will profile the table, run a structured or sandboxed SQL query, or diff two datasets. Exact row counts, column stats, aggregations and bounded result sets come back as JSON, so a language model does not have to load a giant spreadsheet into its context window or guess at a total.
It does not call a language model. Loading, typing, querying and diffs are deterministic.
When an AI agent should use this
Use geeky_goth_gamer/spreadsheet-json-query-engine when:
- You have a CSV, Excel workbook, JSON array or NDJSON dump that is too large (or too easy to miscount) to paste into the model.
- You need an exact
row_count, per-column types/nulls/distinct values, numeric min/max/sum/mean/median, or a few sample rows. - You want to filter, sort, group or aggregate without writing SQL, or you want to run a read-only
SELECT/WITH ... SELECT(including joins across Excel sheets). - You need to compare two versions of a table (added / removed / changed rows, schema changes, numeric sum deltas).
Don't use it for:
- Writing back to a file, or any SQL that is not a single
SELECT. - Private, intranet or metadata URLs (they are rejected).
- Legacy
.xlsworkbooks (save as.xlsx) or files larger than 25 MB.
Example input:
{"mode": "query","format": "csv","data": "region,units,price\nTasmania,3,10.5\nTasmania,1,10.5\nVictoria,2,8\n","sql": "SELECT region, SUM(units) AS units, ROUND(AVG(price), 2) AS avg_price FROM data GROUP BY region ORDER BY units DESC"}
Output: A single dataset item with status, compact source metadata (row/column counts and the original→SQL-safe columnMap), the result rows, and truncated if maxRows was hit. Profile mode adds per-column stats and sampleRows. Diff mode adds addedCount / removedCount / changedCount, schema, sumDeltas and bounded samples.
Cost: $0.003 per inline profile, query or diff; $0.005 per public URL fetched (a two-URL diff charges twice). Invalid input is not billed. Apify also charges the standard $0.00005 Actor-start fee on ordinary runs.
Call it from an agent:
- Apify MCP server: add
https://mcp.apify.com/?tools=geeky_goth_gamer/spreadsheet-json-query-engineto your MCP client; the tool isgeeky_goth_gamer--spreadsheet-json-query-engine. Or usecall-actorwith"actor": "geeky_goth_gamer/spreadsheet-json-query-engine". - Standby HTTP:
POST https://geeky-goth-gamer--spreadsheet-json-query-engine.apify.actor/query(alsoPOST /profile,POST /diff) withAuthorization: Bearer YOUR_TOKENand the input JSON.GET /healthis a liveness check. - Python:
ApifyClient(token).actor("geeky_goth_gamer/spreadsheet-json-query-engine").call(run_input=...), then readclient.dataset(run["defaultDatasetId"]).list_items().items. - HTTP run:
POST https://api.apify.com/v2/acts/geeky_goth_gamer~spreadsheet-json-query-engine/run-sync-get-dataset-items?token=YOUR_TOKENwith the input JSON as the body.
Why this exists
Agents miscount rows, drop filters, and blow their context window when they ingest a whole spreadsheet. This Actor loads the file once (inline or SSRF-safe URL, 25 MB cap), flattens nested JSON, normalises headers to SQL-safe names, infers types, and then either profiles the table, runs a structured query, or executes a read-only, sandboxed SELECT against in-memory SQLite (table data, plus named sheets). A second dataset can be diffed with optional key columns.
Input
| Field | Default | Notes |
|---|---|---|
mode | query | profile, query or diff. Standby routes set this for you. |
data / url | (one required) | Inline text (or a JSON array/object on the HTTP API) or one public http(s) URL. Not both. Max 25 MB. |
format | auto | csv, tsv, xlsx, json, ndjson (or jsonl). |
jsonPath | (none) | Dot-path to the records inside a JSON payload, e.g. items or data.rows. |
sheet | (none) | Load only this Excel sheet; otherwise every sheet is a SQL table (first sheet is also data). |
sql | (none) | A single SELECT or WITH ... SELECT. Do not also pass structured filters. |
filters | (empty) | {column, op, value} with eq/neq/gt/gte/lt/lte/contains/in/is_null/not_null. |
groupBy / aggregations / sortBy | (empty) | Aggregations: count, sum, avg, min, max, count_distinct. |
limit / maxRows | 200 | Output cap, 1–1000. |
sampleRows | 5 | Profile (and query preview) sample size. |
left / right | (diff) | Each is {url} or {data} plus optional format / jsonPath / sheet. |
keyColumns | (none) | Diff keys so changed rows can be reported (without keys, only added/removed multisets). |
timeoutSeconds | 30 | Download time limit. |
maxFileSizeMb | 25 | Download / inline size cap. |
Output
The default dataset holds one envelope. Common fields: status, mode, source, billed, eventsCharged, durationSeconds.
- profile:
rowCount,columnCount,duplicateRowCount,columns(inferred type, null/distinct counts, numeric stats,topValues),sampleRows. - query:
columns,rows,rowCount,truncated, the SQL that ran (sql). - diff:
addedCount,removedCount,changedCount,schema(addedColumns,removedColumns,typeChanges),sumDeltas, and boundedaddedSample/removedSample/changedSample.
Standby / Server mode
When started through Apify's server interface (APIFY_META_ORIGIN=STANDBY), the Actor listens on ACTOR_WEB_SERVER_PORT and handles:
GET /health— livenessPOST /profile— profile a tablePOST /query— structured or SQL queryPOST /diff— compare two datasets- Any request carrying the
x-apify-container-server-readiness-probeheader is answered immediately with HTTP 200 and bodyok
Standby URL: https://geeky-goth-gamer--spreadsheet-json-query-engine.apify.actor
Pricing
| Event | Price | When it is charged |
|---|---|---|
query-inline (primary) | US$0.003 | One successful inline profile, query or diff. |
query-url | US$0.005 | One successful URL-fetched file (a two-URL diff charges 2). |
apify-actor-start | US$0.00005 (Apify default) | Once when a standard run starts. |
Failed input (the Actor refused the request) is not billed. Your maximum cost per run is respected.
Safety
URL fetches are SSRF-safe: only http/https on standard ports, every redirect hop is re-validated, and private, loopback, link-local, CGNAT and cloud-metadata addresses are blocked. Downloads and inline payloads are size- and time-capped. Excel workbooks are opened in read_only mode after zip-bomb / oversized-part checks.
SQL runs against in-memory SQLite with conn.set_authorizer(...) allowing only SELECT / READ and a tight function allowlist. ATTACH, DETACH, PRAGMA, INSERT/UPDATE/DELETE, DROP/CREATE/ALTER, VACUUM, load_extension and multi-statement SQL are rejected. A progress-handler time limit (2 s) and maxRows cap stop hostile or cartesian queries from tying up the process.
Limitations
- Legacy
.xlsis not supported; save as.xlsx. - Very wide (over 200 columns) or very tall (over 200,000 rows) tables are rejected.
- Nested JSON arrays are flattened as a JSON string in one cell; objects are flattened with dot notation.
- Without
keyColumns, a diff cannot pair “changed” rows and reports only added/removed counts. - The SQL sandbox is intentionally narrow: useful analytics functions are allowed, write and extension APIs are not.