Hello, I want to delete data that column Type ≠ T
Please guide me for solve it.
Thank you
input.xlsx (8.6 KB)
Hello, I want to delete data that column Type ≠ T
Please guide me for solve it.
Thank you
input.xlsx (8.6 KB)
Hi @Stef_99
Try this syntax:
filteredDataTable = (From row In dtInput.AsEnumerable()
Where Not row.Field(Of String)("Type") = "T"
Select row).CopyToDataTable()
Input:
Output:
Hope it helps!!
Assign activity:
Left side: dtFiltered
Right side: dt.AsEnumerable().Where(Function(row) row("Type").ToString() = "T").CopyToDataTable()
Please use this linq query in Assign activity
Hi @Stef_99
You can use the LINQ Expressions to get the required output, Check the below steps,
→ Use the Read range workbook activity to read the excel and store in a datatable called dt_Input. Give “A3” in the range field.
→ Then use the assign activity to write the LINQ Expression,
- Assign -> dt_Input = dt_Input.AsEnumerable.Where(Function(row) Not(row("Type").ToString.Equals("T"))).CopyToDataTable()
→ Then use the Write range workbook activity to write the dt_Input to the Excel file.
Check the below workflow for better understanding,
Sequence2.xaml (13.0 KB)
Check the output data in Sheet2 in the below excel file,
input.xlsx (9.0 KB)
Hope it helps!!
@mkankatala @rlgandu @Parvathy I want to write output in same sheet.
Hi @Stef_99
In that case please use Excel activities to delete the rows that are not equal to T.
Regards
Okay @Stef_99
I have changed the total flow, you can do it with the Excel activities and LINQ Expressions.
Check the below workflow for better understanding,
Sequence2.xaml (16.6 KB)
Check the output file,
input.xlsx (8.5 KB)
As your requirement the output data is in Sheet1.
Hope it helps!!
Hi @Stef_99
or
Excel.Sheet("Sheet1").Range("A3:C" + (Excel.Sheet("Sheet1").RowCount + 1).ToString())
Hope it helps!!
I have question after run it have filter icon as below.
If I want clear icon filter how to solve it.
@Stef_99
Use the filter activity again and check the clear existing filter
Refer the above image
Sub RemoveFilters(sheetName As String)
Dim ws As Worksheet
On Error Resume Next
Set ws = ThisWorkbook.Sheets(sheetName)
If Not ws Is Nothing Then
If ws.AutoFilterMode Then
ws.AutoFilterMode = False
End If
End If
On Error GoTo 0
End Sub
Vb code for removing Filter icon
Output:
Hie @Stef_99
here your input
filter condition
filter activity
Result output
Read data and use linq query you can delete!
Or else you can use VBA or you can use excel Activities for deleting
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.