Facing difficulty in clearing the excel sheet data

Hi,

Here data scrapping is being performed. From the data scrapping data i need to fetch the filename. For that I am using the excel sheet to write the data, problem here is the overwriting not clearing the sheet.
Only for 1st iteration its clearing for rest its over writing. Not able to use clear data table getting error as object not set to instance of object. So i used write cell
image
Its working only for 1st iteration and same data over writing.
I used invoke vba also same issue. Can any one help me on this.

Regards,
Lakshmi

Hello @lakshmi.mp ,

Perhaps you could try the Clear Sheet/Range/Table activity.

Link: https://docs.uipath.com/activities/docs/clear-range-x

Best regards,
Marius

1 Like

Hello @lakshmi.mp

Are you trying to write the datatable to excel?

Then you have to use Write Range activity. It will clear the existing data and replace with the new data.

Thanks

@Rahul_Unnikrishnan , yes
But over writing.

image
Range should be blank. I will try this.

can you please share a screenshot of the workflow?

Else you delete the sheet using Delete sheet activity and then use Write Range to create the sheet again.

Thanks

@Rahul_Unnikrishnan


Getting this error. What to do.

Regards,
Lakshmi

Is this Write Range activity inside an excel scope and is this Data_Extract having some value?

Thanks

Yes its inside excel app scope and has some values.




Please look on it.
Regards,
Lakshmi

image
Try like this in Range use " "

@prithivi_raj_shanmugam


Getting error.

Can you share the datable value in debug mode? If datable is empty “Write range: object reference” error will come. Run in debug mode and view the output of extract structed data variable “Data_extract”.

image

@lakshmi.mp in Range use “” without space, by mistake I gave with space. Try without space it will work

image

@prithivi_raj_shanmugam @Rahul_Unnikrishnan @Marius_Puscasu , thanks for helping.
Again i did data scrapping for that particular screen and now able to clear the excel data using clear data table activity, and mentioned value in default. New System.Data.DataTable
Issue resolved.

Thanks,
Lakshmi

1 Like

good to hear that @lakshmi.mp

1 Like