Pivot Table
data.pivot_table
Overview
When you send tabular rows, grouping fields, and aggregation specs, we return a pivot summary with count, count_distinct, sum, avg, min, or max — sorted by group key and capped at maxGroups. Numeric aggregations reject non-numeric values. Do not use this for formula languages or locale-dependent number parsing.
You need reproducible summaries without writing aggregation code in every agent.
Reliability
Same rows and same spec give the same table back, groups in the same sorted order. count counts rows in the group whatever field names, and count_distinct skips nulls. Sums and averages use double-precision floating point, so long decimal columns can carry a small rounding tail. We are strict about numbers: sum, avg, min and max accept JSON numbers only, and a numeric string such as "10" stops the call — reach for data.aggregate if you need numbers parsed out of text. None of the refusals are worth retrying unchanged: we stop when rowFields or aggregations is empty, a measure names a function we do not know or omits field, a value we must add up is not a number, the grouping produces more than maxGroups buckets (raise maxGroups up to 100,000 or group on fewer columns), or you send more than 200,000 rows.
Context footprint
Returns pivot rows, groupCount, and warnings. A successful call costs 1 execution credit.
When to use it
For bounded tabular data and explicit group/aggregation specs.
When groups may exceed maxGroups or values need locale-aware parsing.
Scope
Non-goals
- No formula or expression language
- No implicit locale-specific number parsing
- Does not stream unbounded datasets
Properties
Capabilities
Cost & billing
Flat rate per invocation
File handling
How we handle your data
What this means
This skill may receive sensitive content and may return submitted, transformed, extracted, or reformatted content.
Squillify guarantees
- Runs inside Squillify
- This skill runs inside Squillify.
- Payloads are not sent to an external service by this skill.
- Squillify does not permanently store submitted payloads.
- Telemetry records metadata only, not submitted content.
- Submitted payloads are not used for training.
- Submitted payloads are not reviewed by humans.
- This skill does not target sensitive data.
- The response may contain submitted or transformed content.
Your responsibility
Squillify does not determine whether submitted content is sensitive. Your application is responsible for deciding what data it is allowed to submit. Your application is responsible for securing the response.
Input schema
| Field | Type | Required | Description |
|---|---|---|---|
| rows | array | Yes | Bounded array of 0 through 200000 input row objects keyed by column name, where missing keys count as null. |
| rowFields | array | Yes | Bounded non-empty array of column names whose combined values make one output row. |
| columnFields | array | No | Bounded array of columns spread across the row as labelled measure prefixes; omit it for plain measure names. |
| aggregations | array | Yes | Bounded non-empty array of closed measures computed for each group. |
| includeTotals | boolean | No | Whether a grand-total row is appended; omit it for false. |
| maxGroups | integer | No | Maximum distinct groups; omit it for 10000. |
Output schema
| Field | Type | Required | Description |
|---|---|---|---|
| rows | array | Yes | Bounded array of 0 through 200000 result row objects keyed by column name after this skill transformed the table. |
| groupCount | integer | Yes | How many groups were found, excluding any grand-total row. |
| warnings | array | Yes | Bounded array of 0 through 16 closed warnings with code and message. |
API contract
POST /v1/executecurl -sS -X POST "$BASE/v1/execute" -H "Authorization: Bearer $KEY" -H 'Content-Type: application/json' -d '{"skillKey":"data.pivot_table","input":{"rows":[{"cat":"a"},{"cat":"a"},{"cat":"b"}],"rowFields":["cat"],"aggregations":[{"field":"cat","function":"count","as":"n"}]}}'import { Squillify } from "@squillify/sdk";
const sq = new Squillify({ apiKey: process.env.SQUILLIFY_API_KEY });
const { output } = await sq.execute("data.pivot_table", {"rows":[{"cat":"a"},{"cat":"a"},{"cat":"b"}],"rowFields":["cat"],"aggregations":[{"field":"cat","function":"count","as":"n"}]});Errors
| Code | HTTP | Retryable | Description |
|---|---|---|---|
| VALIDATION_ERROR | 400 | No | The request payload failed schema validation. |
| UNAUTHORIZED | 401 | No | Missing or invalid API key. |
| SKILL_NOT_ACCESSIBLE | 403 | No | The API key is not granted access to this skill. |
| SKILL_NOT_AVAILABLE_FOR_PLAN | 403 | No | This skill is not included in your current plan. |
| PLAN_ELIGIBILITY_UNAVAILABLE | 503 | Yes | Plan eligibility could not be decided. Retry after backoff. |
| SKILL_NOT_FOUND | 404 | No | The requested skill or version does not exist. |
| TENANT_RATE_LIMITED | 429 | Yes | Request rate limit exceeded. Retry after backoff. |
| QUOTA_EXCEEDED | 429 | Yes | Plan quota exhausted. Retryable once the quota period resets. |
| EXECUTION_TIMEOUT | 504 | Yes | Execution exceeded the allowed time budget. |
Other limits
| Limit | Value |
|---|---|
| Recommended inline bytes | 32 KiB |
Limitations
- No formula or expression language
- No implicit locale-specific number parsing
- Does not stream unbounded datasets
- Streaming aggregation of huge datasets
- Spreadsheet-style calculated fields
How to call
POST /v1/execute (requires authentication)
{
"skillKey": "data.pivot_table",
"input": {
"rows": [
{
"cat": "a"
},
{
"cat": "a"
},
{
"cat": "b"
}
],
"rowFields": [
"cat"
],
"aggregations": [
{
"field": "cat",
"function": "count",
"as": "n"
}
]
}
}Examples
Count rows per category
{
"rows": [
{
"cat": "a"
},
{
"cat": "a"
},
{
"cat": "b"
}
],
"rowFields": [
"cat"
],
"aggregations": [
{
"field": "cat",
"function": "count",
"as": "n"
}
]
}{
"rows": [
{
"cat": "a",
"n": 2
},
{
"cat": "b",
"n": 1
}
],
"warnings": [],
"groupCount": 2
}Sum amount per category
{
"rows": [
{
"cat": "a",
"amt": 10
},
{
"cat": "a",
"amt": 5
}
],
"rowFields": [
"cat"
],
"aggregations": [
{
"field": "amt",
"function": "sum",
"as": "total"
}
]
}{
"rows": [
{
"cat": "a",
"total": 15
}
],
"warnings": [],
"groupCount": 1
}Recommended use cases
- Quick group-by counts for reporting
- Sum or average by category
- Agent-generated summaries without hand-written code
Avoid for
- Streaming aggregation of huge datasets
- Spreadsheet-style calculated fields
Related skills
Composable with
Safety & privacy
- Runs without calling any external service.
- Your payloads are never stored permanently.
- Telemetry captures metadata only — never your payload contents.
- We never train models on your payloads.
- No human reviews your payloads.