How to clear excel sheet

Hello,

I’m downloading files from website by using table extraction i selected file and url using Table extraction and that all data save in Excel file so

Whenever I’m running the process so each time new record will buy some some time no record is there but the which data available in Excel sheet getting only that file i don’t want to again n again same file

How to clear excel sheet again again?

@suraj_gaikwad

  1. Use a timestamp to save the file so that the filename would be different always…something like this "Extract" + Now.ToString("MMddyyyyHHmmss") + ".xlsx"
  2. You can as well delete the previous file and recreate new
  3. Use clear sheet activity with range or sheet as Excel.Sheet("Sheetname")

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

Hope this helps

Cheers

Hi @suraj_gaikwad

If you are using Excel activities “Use Clear Sheet/Range/Table” activity to clear the sheet. Activities will be Excel Process scope → Use Excel File → Use Clear Sheet/Range/Table

If you are using workbook activities at initial process please read the entire excel using “Read Range Workbook” activity and store it an datatable. then use “Clear Data Table” activity to clear the data in the particular sheet.
image

Hope it helps!!
Regards,

@suraj_gaikwad

Before the Write range…use any of the acitivities specified above

cheers

But which should I use bc i try to use clear data table den I’m passing Excel file path

@suraj_gaikwad

Clear datatable will not work…

use clear sheet

or

Delete file

Or

Use a different filename always

Clear datatablew ill only clear the datatable you are writing but not the excel

cheers

1 Like

Use different file name i didn’t get

@suraj_gaikwad

Whenever you write to excel if you want to preserve the previous excel as well then instead of writing to same excel always we can make it dynamic by adding timestamp as I have depicted above

cheers

1 Like

Okay !

Thanks

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