How to delete content from existing excel sheet

hi friends, I am using a write range to write into an existing excel sheet but i noticed it doesnt clear the excel sheet before writing into it. For example i have 10 rows filled with data, and the bot writes into it three new data and only overwrites three of the rows and not the rest. how can i clear the excel sheet before it writes into it? please provide workflow if possible. i do not want to delete the the excel sheet just clear it.

Just write to a new file, then delete the old file.

@Shazid_Rahman

Check below link for your reference

Hope this may help you

Thanks

i dont want to delete the file

Hey @Shazid_Rahman !! Use write cell activity then pass blank value to range β€œA1:Z50000”

Hope it helps!

could you show workflow please and please keep in mind header must not be deleted

To not delete Headers, pass the range β€œA2:Z50000”

1 Like

Hi @Shazid_Rahman,

Try this method.

  1. Read the excel file using read range activity [FirstDT]
  2. Use Assign activity
    SecondDT = FirstDT.Clone
  3. Add the values in the SecondDT datatable which holds the value with all new values only and the headers will remain the same.

Hope this would help to solve your issue.

Regards,
@90s_Developer

You are writing a new file with the data the way you want it, and deleting the old file. This is literally no different than editing the existing file.

The workbook Write Range would be better, it doesn’t have to open the Excel file. Faster and more reliable.

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