Extracting Rows with set value to a different Excel file

I have an Excel File with about 4 Columns with names like “Column 1”, “Column 2” etc and the rows are dynamic. I want to try to take out all the rows that have 0 or negative in “Column 3” and put it into a different Excel file. Thanks!

@daqc

  1. Use Read Range activity to read the data from excel file and it will give output as DataTable. Let’s say ‘DTExcelData’.

  2. And then try below expression.

DTRequiredData = DTExcelData.AsEnumerable().Where(Function(row) Cint(row(2).Tostring)<=0).CopyToDataTable

  1. And then use Write Range activity and pass ‘DTrequiredData’ to it.
2 Likes

I should’ve said I’m using read range and using the Datatable extensively, the overall process is not related to the problem so I didn’t post it in detail. I can’t test right now, so I’ll let you know if your answer works when I can. Thank you.

1 Like

Hi it works, thanks a lot but what if I wanted to delete the rows I passed into the new file from the old file?
Nevermind, Using Filter DataTable after I get the data works. Thanks for the help :smiley:

1 Like

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