Skip to main content

Querying Data

The /query endpoint lets you compare column values using a small set of operators. Use it when you need numeric or date comparisons; for plain text matching with wildcards, see filtering.

Operators

OperatorMeaningExample
__eq()Equal?Id=__eq(1)
__ne()Not equal?Id=__ne(5)
__lt()Less than?Amount=__lt(5.75)
__lte()Less than or equal?Amount=__lte(5.75)
__gt()Greater than?Created Date=__gt(8/01/2021)
__gte()Greater than or equal?Created Date=__gte(8/01/2021)

The operator value goes inside the parentheses. Operators apply to numeric and date columns.

Single-column queries

# Amount greater than 5.75
curl 'https://api.sheetbest.com/sheets/YOUR_SHEET_ID/query?Amount=__gt(5.75)'

# Hire Date earlier than 7/01/2021
curl 'https://api.sheetbest.com/sheets/YOUR_SHEET_ID/query?Hire Date=__lt(7/01/2021)'

Multiple columns

Combine multiple parameters in the same /query URL. All conditions must match. Wildcards from filtering work alongside operators.

# Amount >= 1000 AND Age <= 56
curl 'https://api.sheetbest.com/sheets/YOUR_SHEET_ID/query?Amount=__gte(1000)&Age=__lte(56)'

# Name contains "Jane", Age >= 21, Hire Date before 7/01/2020
curl 'https://api.sheetbest.com/sheets/YOUR_SHEET_ID/query?Name=*Jane*&Age=__gte(21)&Hire Date=__lt(7/01/2020)'

# Amount < 500 AND Customer Email starts with "L"
curl 'https://api.sheetbest.com/sheets/YOUR_SHEET_ID/query?Amount=__lt(500)&Customer%20Email=L*'

Empty values

To match rows with an empty value in a column, leave the value blank:

# Rows where Name is empty
curl 'https://api.sheetbest.com/sheets/YOUR_SHEET_ID/query?Name='

For numeric or date columns, use None:

# Rows where Created at is empty (date column)
curl 'https://api.sheetbest.com/sheets/YOUR_SHEET_ID/query?Created%20at=None'

Tips

  • Column names with spaces should be URL-encoded (Customer%20Email) when needed; HTTP clients usually do this for you.
  • Dates follow the format used by your sheet (e.g. 7/01/2021).
  • For text containment without comparison operators, use filtering and its wildcard syntax.

Next steps

  • Pagination to limit results from a query.
  • Tabs to query a specific worksheet.