Append Row in Google sheets, but descending

Hello!

I use Append Row to add datatable extracted from a website.
the activity “Append Row” put the new data at the end of the existing datatable.
I need to be sorted descending, depending on the 2 columns, Date and Time that I added additionally. I used "Sort Data table, but it seems it doesn’t works, nothing happens; I used “Sort Datatable” and then Write range, but sorting is not well done.
Could someone help me on this activity?
Thank you for your answer!

Ruxandra

Hello @Ruxandra_Zamfir ,

There is no activity to sort the data in the google sheet, here what you can do is create an app script and execute it using UiPath.

Thanks,
Sanjit

HI @Ruxandra_Zamfir

Have you tried like this

  • Use read range and read the gsheet and store them in a variable DT1
  • Use a build datatable
  • Add the rows in that table and
  • At last sort the datatable and then
  • Use write range and disable write headers and give the cell as “A”+(DT1.ROws.Count+1).Tostring
    image

If you need to sort the whole sheet after appending the rows try this

  • After appending all the rows read them and store them in a datatable
  • Now Sort the datatable
  • and use write range and in the A1 with headers

Regards
Sudharsan

Hello!

I need to sort entire sheet. I’ve already made something like you told me, it didn’t work correctly, I’ve made as you said, it doesn’t work, which makes me think that the problem comes from the sorting activities, I have 2 activities “Sort datatable”, first, by the column “Date”, second, by the column “Times”. It doesn’t work. I’ve made a test using one “sort datatable activity”, by Date, but it doesn’t work either.

Do you have any idea of what happend?

Thank you!

Regards!

Ruxandra

Okay @Ruxandra_Zamfir Try this way

Wtite the whole datatable in the excel and then use macros to sort them and them read that excel and write them in the gsheet

Regards
Sudharsan