Hi, I would like help with deletion of excel rows when cells in a specific column are empty.
There are similar questions but nothing works for me.
I use copy/paste range to copy several columns from one excel file to another and then I want to delete rows at the destination file when cells in column C are empty. The destination file is being created while the automation runs. I have tried both ‘‘If cell empty- delete rows’’ and ‘‘Read range- filter range’’ but I cannot make it work.
Below you can see the beginning of the automation and the excel I want to delete the rows from.
check the reference
Assign activity:
destinationDataTable = destinationDataTable.AsEnumerable().
Where(Function(row) Not String.IsNullOrEmpty(row("C").ToString())).
CopyToDataTable()
This linq query helps you to take the rows of Column C which are not empty and store the result in a datatable.
Replace C with your column C
resultDt = (From row In YourExcelDataTableVariable.AsEnumerable()
Where row.Field(Of String)("C") = String.Empty
Select row).CopyToDataTable()
Hope it helps!!
Thanks for your reply!
This is exactly the what I want to do, but still cannot manage to make it work.
My actions look a bit different than yours and when I try to put in the details in “write range” it doesn’t let me to choose the correct workbook and keeps giving me errors.
Thanks for you reply, but I don’t how to write the code I am using the activities tab.