Could you please someone let me know the logic or workflow to delete only even rows in Excel
What about something like the loop below. It will be slow, and depending on your row count, might even be unreasonably slow, but it is still one way to do it.
You first get your MaxRowNumber (multiple ways to do it on the forum), to get the number, when the loop should start. Also start your step at 2. Then use the “Insert/Delete Rows”, with change mode set as Remove, and the Position is your StepNo.
After each step you would just increase it by 2, instead of 1, so it is always even. Have not tried it myself, but it should work - make sure that your variables are correct format though.
Hi @N_Tilak_Babu ,
you can try this code
First read entire data using Read Range Activity and will give output as dataTable and say ‘DT’.
Datatable (Your Variable) = DT.AsEnumerable().Where(Function ®CInt(r(“Column Name”).ToString) Mod 2 <>0).CopyToDataTable
Then use Write Range Activity to write into Excel file and pass yourvariable to it.
Refer the attached workflow
Delete Even Row.xaml (5.2 KB)
Hope this helps, if it works mark it as solution
Thanks for your solution.Its working Fine ,Could you please let me know how to solve this without SL.no column
Thanks for your Solution.It worked Fine. RemoveEvenRows.xaml (7.7 KB)
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.