How to replace particular row items from same excel?

Hi,

From uploaded attachment. I want to replace particular row into 1st place and already existing 1st row item to that replaced row.

Ex: Replace 7th row item to 1st row and 1st row item into 7th row.

What logic should we approach and activities to follow ?

Thanks

InputSheet.xlsx (9.0 KB)

Read range for reading in the excel into a datatable -dtData

EDIT: Item Array Swap strategy

Assign Activity
FirstRowRA = dtData.Rows(0).ItemArray
ChangeRowRA = dtData.Rows(6).ItemArray

dtData.Rows(0).ItemArray = ChangeRowRA
dtData.Rows(6).ItemArray = FirstRowRA

How to “Delete Data Row for deleting first and other row” ?

Could you please share demo xaml file ? for better understanding.

In collaboration with one of my colleagues, we found a more compact approach.
:+1: @kumar.varun2

Strategy: ItemArray Swapping

grafik

ItemArrayList = arrSwapIDX.Select(Function (x) dtData.Rows(x).ItemArray).toList
First row:
dtData.rows(arrSwapIDX.first()).itemArray = ItemArrayList.Last()
Second row:
dtData.rows(arrSwapIDX.Last()).itemArray =  ItemArrayList.First()

Find initial starter help here:
DT_SwapDataRows.xaml (13.4 KB)

1 Like

Thank you.

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