1. Home
  2. Docs
  3. Custom API
  4. Sort, Order & Filter Options

Sort, Order & Filter Options

Once the data is imported to the sheets via the API, there might be times that the ordering of the columns might change for the future imports.

So in order to preserve the ordering of the column, you can use Sort, Order & Filter options.

customapi_sort_order_filter

Let’s look at it..

Ordering Columns

As defined in above scenario, in order to preserve the output data’s column ordering, you can input the output data’s headers in the “Include Columns” fields.

NOTE: To get the output data headers, you will have to first run the query (without Include columns field) to see the headers in the output data sheet.

This will do 2 things

  • Only output the columns mentioned in the Include Columns section
  • Order the columns based on the input.

Sorting Rows

To use the sort feature, you should have included the column headers in the “Include Columns” section.

You can now simply select the column to sort and sort type as

  • Ascending Or
  • Descending

Filtering Rows

To use the filter feature, you should have included the column headers in the “Include Columns” section.

Once done, you can simply click on +Add filter button and then

  • Select the column header
  • Select the condition.
  • Enter the value

You can add multiple filter to the query.

NOTE: All the filters will “AND” the condition.

 

Let’s take a Use Case

Let’s say, we are trying to import the data from the API for the first time. The Url is https://reqres.in/api/users?page=1.

Step -1: Import the data

  • Enter the url: https://reqres.in/api/users?page=1 in the API url section
  • Click on Export

Step -2: Re-Import the data with the headers in “Include Columns”.

  • Now you copy the headers which you actually need and then paste it in the “Include Columns” section.

customapi_sort_order_filter_usecase_include_columns

  • Once done, you can now re-import the data by clicking on the Export button.
  • Now you will only see the four columns

customapi_sort_order_filter_usecase_include_columns_output

 

(OPTIONAL)

  • We have also included the sort field as “data_id” and sort type as ascending.
  • Also we want to output the users whose first name starts with “E”. So we have added a regex filter as “data_first_name” matches “^E”. 

customapi_sort_order_filter_usecase_sort_filter_output

  • On clicking Export, we get the desired output as per the configuration.

 

Leave a Reply

Your email address will not be published. Required fields are marked *