Hello,
i am writing some data in excel and one it is done i need to get last row of the excel and ned only that data should be remain in excel i first row like below
current data in excel -
expected output -
how can i achieve this?
any filter i ned to use?
Hi @Mathkar_kunal ,
Read Range into dtData.
Get last row:
lastIndex = dtData.Rows.Count - 1
Create new DataTable and keep only last row:
dtResult = dtData.Clone
dtResult.ImportRow(dtData.Rows(lastIndex))
Write Range back to Excel (overwrite sheet).
ok,
so here
dtResult = dtData.Clone
dtResult.ImportRow(dtData.Rows(lastIndex))
dt resut i need to do in assign
what about dtResult.ImportRow(dtData.Rows(lastIndex)) ??
ok have some questions regarding activity
wht i need to write in range as my range varies sometimes it will be A1:B5 or sometimes A1:B10 with headers.
have two column as showed i my queery.
what i need to fill in remainig fields of this activity?
and how output will besaved? and how it will write in next sheet if i create?
ashokkarale
(Ashok Karale)
February 20, 2026, 11:08am
6
Just pass the sheet range like Excel.Sheet("Sheet1")
Use Read range activity to get data from range “A”+intLastRowIndex.ToString+“:B”+intLastRowIndex.ToString
Then write this range in the new sheet.