Modern excel insert row activity, unable to insert row

Hi there,

I am trying to insert row for in an excel file to a specific column. The excel file is in table design. In the table design to insert Row to a specifc range like B1:P1, what is the syntax i should add when i use insert row excel modern activity.

Hi @mark_rajkumar1

Please refer below screenshot, in this one, i have given reference as Excel1 to my excel file, then in insert rows activity, I selected the sheet by clicking on plus sign and navigating through the Excel1. when you hover on its name, it will show the sheets available and so on.

I am adding a row at row index 2. You can customize your details accordingly.

Hi @sonaliaggarwal47 if i want to insert row in the table in excel for the specific column like B10:P10. What will be the syntax?

Hi @mark_rajkumar1

When you select sheet, then also add .range(b1,p1) in the end and see if it works

@mark_rajkumar1

I believe that is not how insert works..it inserts a fresh row completely

cheers

Hi @mark_rajkumar1

You can try below steps
Use read range workbook activity store it in variable say for example dtinputdata
Use assign activity dtInputdata.Rows.InsertAt(dtInputdata.NewRow(), 0) '0 = First Row, 1 = Second, etc like this
Then use write range to write

Hope this works

Hi @Anil_G @vhvinodsai , i have actually write a datatable into an excel. That excel is in a table design. So i need insert only one row to from column b10:p10 so the rest of cells will go down. This is the reason i am using insert row. I need syntax when handling excel which are in table design.

Hi @sonaliaggarwal47 when i put it in sheet manner, i m getting an error. How to put a row in a table design.

@mark_rajkumar1

Excel.Table("Tablename") use this

change tablename to the tablename you have

cheers

@Anil_G but i wan to insert only in specific column b10:p10 where the table range starts. How to indicate the range? Cos i am getting syntax error.

Hi @mark_rajkumar1

Please refer screenshot below. When you specify range, then "where " property should be set to either start or end, not specific index else it will throw error. I just inserted a row at range(D4:K4) and my row was inserted in that place, refer excel snapshot below.

Hope this helps.

@mark_rajkumar1

if you give table name and start as where then it would insert in start

cheers

@Anil_G Anil_G I cannot specify range for table?

@sonaliaggarwal47 when I use as above method I keep getting error saying range is not found. Not sure it because it’s abtable

Hi @mark_rajkumar1

please verify if you are providing the right range.

Also can you share screenshot from your excel file that shows the range where you are trying to add a row?

I am inserting row at r10 to t10. All I get is range does not exist. Is it because it’s table design?

1 Like

@mark_rajkumar1

I don’t think specifying the specific index for a table is possible not at least via this activity directly. It can only be inserted either at the beginning of the table or end of the table.

I think range along with table won’t work.

For me, it worked because it’s not a table.

Than @sonaliaggarwal47 how to do it for table

@mark_rajkumar1

Can you show me your activity how have you specified details in there?