Kia1
(Ana)
1
i have a UiPath flow
read the CSV file, then write all the CSV data into Excel.
When it is finished it becomes data in Excel, because the data dynamically follows the data in CSV
after that, I want to delete the last two rows in dynamic excel data
How to delete dynamic Excel last row data?
Hello
Try these options:
Option1:
Option2:
dt.AsEnumerable().SkipLast(2).CopyToDataTable()
Note: this may not work depending on your version of the REF - as it only works in “Windows-Legacy” method only.
Hopefully this helps,
Cheers
Steve
Hi @Kia1 ,
You can do this as below,
Final_DT.AsEnumerable().Take(Final_DT.Rows.Count - 2).CopyToDataTable
selects all the rows from the DataTable Final_DT except the last two rows and creates a new DataTable containing those rows.
Regards,
Vinit Mhatre
lrtetala
(Lakshman Reddy)
4
Hi @Kia1
Try this
(Excel.Sheet("Sheet1").DataTableValue.RowCount-1).ToString+"-"+(Excel.Sheet("Sheet1").DataTableValue.RowCount).ToString
Input:

Output:

Note: If you want to remove only last row use the below
(Excel.Sheet("Sheet1").DataTableValue.RowCount).ToString
Regards,
system
(system)
Closed
5
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.