Documentation
Search

Search

Returns an array of all rows matching the query. If any condition is not met for a row, it will not be included in the result.

GET https://api.sheet2db.com/v1/{connection-id}/search/{sheet}?

if you want a row to be included in the result when any condition is met, use the serach_or endpoint

GET https://api.sheet2db.com/v1/{connection-id}/serach_or/{sheet}?

Path Parameters

sheet string (Optional)

Specify the name of the sheet (tab) you wish to select within your Google Spreadsheet.


Query Parameters

__limit integer (Optional)

Set a limit on the maximum number of rows to be returned, providing control over result volume.

__offset integer (Optional)

Determine the starting point for fetching results, allowing you to skip a specified number of initial results.

__columns string (Optional)

Specify the column name(s) that you want to include in the result. You can use multiple column names, separated by commas, to perform this operation.

__cast_numbers string (Optional)

Specify the column name(s) that you want to cast into numeric values. You can use multiple column names, separated by commas, to perform this operation.

__sort string (Optional)

Name of the column by which you want to sort the result. To specify sort order, add : after column name followed by order (asc or desc). Defaults to desc

Example: https://api.sheet2db.com/v1/{connection-id}?sort=Age:asc

__sort_method enum (Optional)

If you want to sort by date, set this attribute to date, Sheet2DB will try to automatically detect the data format but it is recommended to specify the format in the sort_date_format attribute.

__sort_date_format string (Optional)

Applies only when sort_method=date.

Date format, e.g. if your date is 2022-19-12 use YYYY-mm-dd. For date time like 2022-19-12 13:55:00 use YYYY-mm-dd hh:mm:ss.


Wildcards

You can search using wildcards. The asterisk (*) can represent any string.

Examples:

  • You can filter all rows with Jane inside the "name" column by using name=*Jane*
  • You can filter all rows that starts with Jane inside the "name" column by using name=Jane*
  • You can filter all rows that ends with Jane inside the Name column by using name=*Jane

Relational operators

You can use relational operators to determine whether a value is greater or less than a given number,date or string.

operators

Equals (=) This operator checks if the value of the specified property is equal to the given value.

Example: age=25 would match objects where the "age" property is exactly 25.


Not Equals (!=) This operator checks if the value of the specified property is not equal to the given value.

Example: age!=18 would match objects where the "age" property is not equal to 18.


Greater than equals (>=) This operator checks if the value of the specified property is greater than the given value.

Example: age>=21 would match objects where the "age" property is either 21 or greater.


Greater than (>) This operator checks if the value of the specified property is greater than the given value.

Example: age>18 would match objects where the "age" property is greater than 18.


Less than equals (<=) This operator checks if the value of the specified property is less than the given value.

Example: age<=25 would match objects where the "age" property is either 25 or less.


Less than (<) This operator checks if the value of the specified property is less than the given value.

Example: age<30 would match objects where the "age" property is less than 30.


Example Request

curl -XGET 'https://api.sheet2db.com/v1/{connection-id}/search?name=John&age>20'

Example Response

 
[
    {
        "id": "7",
        "name": "John",
        "age": "21"
    }
]