Skip to main content

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

OperationDescription
sumSum of values per column
prodProduct of values per column
maxMaximum value per column
minMinimum value per column
meanMean / average per column
medianMedian value per column
stdStandard deviation per column
varVariance per column
anytrue if any row has a value, otherwise false
alltrue if every row has a value, otherwise false

Examples

# 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'

Notes

  • The response contains one entry per column, scoped to the operation. For example, agg/sum will 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.