Is there a way to delete all the data from a sheet in excel without having excel installed on the machine bot will be running from?
I have a scenario where I need to read some data, manipulate, add, filter…then rewrite to the same sheet. Using only Write range will not work because if the beginning DT and the new DT are not the same size all the original data will not be overwritten…there will be leftovers.
So I need to read the original data then manipulate it using dt variables…then delete the original data from the sheet and rewrite the manipulated dt to the same excel sheet.
If you only want to retain the headers, then we could try emptying the rows without deleting them before writing it back to Excel using the Workbook Write Range Activity →
(From row In dt_sampleData.AsEnumerable()
Let rw = row.ItemArray.ToList()
Let empty = rw.ConvertAll(Function(c) c.ToString.Replace(c.ToString,"")).ToArray()
@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 :
Let the Datatable be DT
We get the Column Letter of the Excel by using the Column Count information as follows :