You mean , you want to delete all the cells in excel and make it blank and remain only with the headers right? We have clear data table activity where it will clear all the data in that data table. so read the excel and store in data table. then use clear data table activity and then write it back to excel.
Use the delete range activity itself and count for the rows and columns by reading the excel and storing in the data table.
- You will get row count as datatable.rows.count
- Column count as datatable.columns.count
- Convert the column count to alphabet using Convert.ToChar(64 + columnCount) and store in variable as columnString
- Provide the range as “A2:” + columnString + rowCount.ToString which will delete the cells from A2 to the end