Clearing existing data in google sheet before write range activity


I am using GSuite application block to write range in a particular spreadsheet
I am getting a value from another spreadsheet and processing it and after which i write the datatable in a new sheet.
First time i am having 20 rows which i am processing and writing and in the next run the output row count reduces to 10.
The new set of data over rights the first 10 rows and the range 10 to 20 is not deleted.

Can some one advice what can be done for deleting the whole range of cells before writing.

Tried: Deleting the sheet and creating a new sheet with the same name before writing but this removes my conditional formatting which is required.

Welcome to uipath community
if we have the data in a datatable variable then we can use CLEAR DATATABLE ACTIVITY which will delete all the records in the input datatable passed to it and we will be having only the headers of the datatable

Cheers @Mani_Kandan

Hi Palaniyappan,

Thanks for the response

Clear data table activity will only clear the value set present in datatable variable and does not make any change to the google sheet, what I am looking for is the clear the values from the google sheet for writing a new range of data…

1 Like

I found a solution if your columns are fixed.

Just read how many rows are there, by reading the sheet into a DataTable and count the row numbers DT.Rows.Count
Then use it into Clear Range activity.

For uncertain column numbers, I think somehow counting column numbers can help.

Hi Palaniyappan,

Even I am facing the same issue.
I have to clear the contents of sheet everytime the robot starts execution.
Clear datatable is not helping with that

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.