Google Sheet connector – View data in descending order

Google Sheets and DronaHQ Studio integration is an easy and assured go-to solution to build user interfaces over the structured data storage that is the power of Google sheets.

You might need to view the latest data of a google sheet on your studio app from your Google Sheet connector configured. Usually, when you retrieve data from Google Sheet in any control, it is arranged the same way it is stored in the sheet.

In this article, we will see a workaround to let you view your data from Google Sheets in a descending order bounded by a table grid control so that you can view the latest data on top.

Prerequisite

You must know have a google sheet connector configured in your studio account and are comfortable working with various endpoints of the google sheet connector. To know about integrating and using of google sheet endpoints you can refer here.

Get all rows data of a Sheet

  1. Insert a table grid control.

  2. Go to its bind data section and click on Connector. Select Google Sheet from Third Party connectors.
    image

  3. Select GetAllRows subcategory.

  4. Select your environment and your account which is configured.

  5. Next, select the spreadsheet and the sheet, from where you want to retrieve the data.

  6. Select the keys you want to bind in the table grid control as columns.

  7. Click Test & Finish.

  8. You will see that the data is displayed in the table grid control. You can edit the column names if needed from the sidebar of the connector under the bind data section and hit Save.

Arrange data in descending order

Now to change the order of the data that respective to a particular column, you need to head to the google sheet where the data is saved.

  1. Select the whole data.

  2. Click on Data > Sort Range > Advance range sorting option.

  3. Select Data has header row. Select the Timestamp column under Sort By (this is to change the order of the data with respect to their timestamp, you can select your own choice of column).

  4. Select Z → A for descending order.

  5. Click on Sort.

  6. Now, go back to the studio and hit the preview. You can see that the data in the table grid is now arranged in descending order with the top value as the latest data according to the date(timestamp).

This is very useful when you have thousands of data in your google sheet and require to view the latest data on top by having the sheet data.