How to add empty row above last line in data table

Hello,

I have a data table and would like to add an empty rows above the last line of the data table - please advise how I could do this

Cheers

Hi @E.T.S

Try this:

dt = dt.Rows.InsertAt(dt.NewRow(), dt.Rows.Count - 1)

Hope it helps!!

@E.T.S

Please put a input and output excel

Hi,

Thanks for your reply!

I get the following with the suggested method:

Cheers

HI,

Thanks for your reply!

Do you mean the input data table then the way I would like the data table to look

Cheers

@E.T.S

Yes that is what i want

Input:

What I would like:

The number of rows of data are variable hence why I cannot just use an add row activity and specify where to add the row

Cheers!

Hi @E.T.S

Can you try the below

YourDataTable.Rows.InsertAt(YourDataTable.NewRow(), YourDataTable.Rows.Count - Math.Min(1, YourDataTable.Rows.Count))

Input:

Output:

Cheers!!

1 Like

Hi @E.T.S

Use the below code in Invoke code:

dt.Rows.InsertAt(dt.NewRow(), dt.Rows.Count - 1)

Invoked Arguments:

Input:
image

Output:
image

Hope it helps!!

That works thank you!

1 Like

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