Delete Excel data range without Excel Installed

@kasey.betts , Assuming that we have the Data already available in Datatable, which Represents the Data in the Excel, we can use it’s Column Count and Row Count information to Clear the Contents using Write Cell Activity.

For Example :

  1. Let the Datatable be DT

  2. We get the Column Letter of the Excel by using the Column Count information as follows :

columnLetter = UiPath.Excel.Helpers.ExcelUtilities.ConvertColumnIndexToColumnLetter(DT.Columns.Count+1)

The above would help us get the Column Letter in Excel.

  1. Now using the Workbook Write Cell Activity, we can write Empty String into the Range below :
"A1:"+columnLetter+(DT.Rows.Count+2).ToString

image

We can Start from A2 or A1 depending on the need.

Try this and Let us know if it doesn’t work

1 Like