I am using "download spreadsheet", how do I make sure that file are overwritten or at least deleted in the destination path every time I run the project?

I am using “download spreadsheet” while trying to download the sheets after making some edits. Now every time I am running my project, files are getting stored in multiple copies. I tried using “delete file”, “delete folder” but it deleted the project folder instead.
Need assistance.

Thanks in advance

Hi @Aakash_Sehgal ,

You could try looping through each file in the Folder and delete each file before downloading the spreadsheet:

If there are no files, the loop won’t throw any error - it just won’t activate.

Kind Regards,
Ashwin A.K

Thanks for your response Ashwin. I will try this approach :slight_smile:

Hi @Aakash_Sehgal
If you want to keep all files then I suggest you to append current datetime in FileName.
If you want keep only recent files only so before download clean the folder by loop over folder and clean all the files.

Hey @Aakash_Sehgal,

In for each activity use Directoty.GetFiles(“DestinationFolder”), inside the activity use delete file activity and pass the item into that activity and check the checkbox ContinueOnError.