How to over write data in excel file

Hi
Iam writing some data in excel and when iam re writing the some data in excel …it is over lapping with the existing data

if existing data count is less than the new data …it wring the complete new data
but when existing data count is more than the new data it is overlapping with old data

kindly help me

You can try deleting the previous excel , if it’s not required then create a new one before writing in it again

if i delete the excel then in next run delete activity will throw error

Hi @T_Y_Raju

Can you share the XAML file and Sample input

  1. Open Excel application scope
  2. Select all data → Ctrl + A & Copy → Ctrl + C
  3. Paste it new file or sheet → Ctrl + V
  4. Use Save workbook activity to save data.

Regards
Gokul

You can use “Path Exists” activity to check if the excel file exists already. If it exists, then delete it.

And simply use write range activity to create the excel file with your desired data.

HI @T_Y_Raju

So this delete activity is after the write range right?

If yes , you can do like this

  • Method 1: Before write range use delete file activity and write range so that the excel will be there for next run.
  • Method 2: Write the new data in some other folder and use move file activity and check overwrite so that it will moved and new excel will be there

Regards
Sudharsan

@T_Y_Raju
You can either check using path exist to check whether such an excel exists and then delete it
Or You can set continue on error property of delete activity as true and next time if the excel is not there it will continue the process without trying to delete it

but the issue is if i dont delete then new fresh data is overlapping with with existing data which i dont want to do this

If continue on error is set to true if there an excel exists it will get deleted, and you can create new excel and write the data in it, also even if there is no excel it will not throw any error as you got earlier (in the next run)

image

ok thank you i will check and update

1 Like

Hi,
You can also use date and time in your excel name, it will create new excel file each and every time you run the process.