Aggregating Data
The /agg/<operation> endpoint runs a column-wise aggregation across the sheet and returns a single object summarising each column. Values that cannot be aggregated for a given operation (for example, summing a text column) are skipped.
Operations
| Operation | Description |
|---|---|
sum | Sum of values per column |
prod | Product of values per column |
max | Maximum value per column |
min | Minimum value per column |
mean | Mean / average per column |
median | Median value per column |
std | Standard deviation per column |
var | Variance per column |
any | true if any row has a value, otherwise false |
all | true if every row has a value, otherwise false |
Examples
- cURL
- JavaScript
- Python
# Maximum value for each column
curl 'https://api.sheetbest.com/sheets/YOUR_SHEET_ID/agg/max'
# Minimum value for each column
curl 'https://api.sheetbest.com/sheets/YOUR_SHEET_ID/agg/min'
# Mean of every numeric column
curl 'https://api.sheetbest.com/sheets/YOUR_SHEET_ID/agg/mean'
# Sum of every numeric column
curl 'https://api.sheetbest.com/sheets/YOUR_SHEET_ID/agg/sum'
fetch('https://api.sheetbest.com/sheets/YOUR_SHEET_ID/agg/max');
fetch('https://api.sheetbest.com/sheets/YOUR_SHEET_ID/agg/mean');
fetch('https://api.sheetbest.com/sheets/YOUR_SHEET_ID/agg/sum');
import requests
requests.get('https://api.sheetbest.com/sheets/YOUR_SHEET_ID/agg/max')
requests.get('https://api.sheetbest.com/sheets/YOUR_SHEET_ID/agg/mean')
requests.get('https://api.sheetbest.com/sheets/YOUR_SHEET_ID/agg/sum')
Notes
- The response contains one entry per column, scoped to the operation. For example,
agg/sumwill not include text columns since they cannot be summed. - For percentile-style summaries (count, mean, std, min, 25%, 50%, 75%, max) of every column at once, see column info.
- To group rows before aggregating, use pivot.