How to add new row in excel sheet

Hi team ,

I have excel sheet with some data , I want to insert a new row in existing data sheet . But when I try to do with add data row activity existing 1st row data is getting deleted. Is there any way to add new row without affecting existing 1 st row data .

Any VBA code is there for inserting new row .

Use the Append Range activity and pass it the datatable with the row(s) you want to add.

Hi @Krishnakumar_Vasudevan

Basically when we are adding new row to existing data sheet it doesn’t delete the first row. Have you checked the Write Range Activity Property to Add Headers option.

I/P:

O/P:

Please let us know for any further clarification.

Hope this helps!!

First row will wont delete actually check this add headers options is enabled or not for read range activity

Hi @Krishnakumar_Vasudevan

Can you please check the Write Range Activity Property to Add Headers option. or try
Using Append Range activity and pass it the datatable you want to add.

Thank you

I want to insert at the top row 1 but it’s getting added in end of the row . Please advice

Hi yokesh ,
Have tried but no luck . It’s storing in end of the row

I want to add it in. First row . Can you please advice .

@Krishnakumar_Vasudevan

Please try this

I/P:
image

O/P:
image

1 Like

@lrtetala I don’t have header in my source file , I am trying to insert {“EmployeeID”,“ErrorID”,“Error Desc”} header information in Row(0)

image

Hi @Krishnakumar_Vasudevan ,
Have many way to add a new row in excel,
1.You can use send hot key to open excel application then use hot key to add row by ‘ctrl’ + ‘shift’ + ‘+’
2.or if you have index or header you can write blank value to last row of data then paste back file

3.or VBA script

regards,

Hi @Krishnakumar_Vasudevan

Try this

Note: Uncheck the Add Headers option in both Read Range and Write Range Activities

I/P:
image

O/P:
image

Cheers!!

@Krishnakumar_Vasudevan

You can use insert rows activity and then insert the required values or write the values using write again

After inserting just write the data to first row as a blank row is inserted

https://docs.uipath.com/activities/other/latest/productivity/insert-rows-x

Cheers

Hi @Krishnakumar_Vasudevan ,

To Change the Headers/Column Names in the Datatable, we can simply iterate through the array of Column Names in the order mentioned and update the column header of the Datatable (provided that Add Headers was disabled when reading the Excel sheet).

The Below configuration should help :

Note: Index variable is declared in the For Each activity to get the index value

After performing this we would require to use Write Range activity with Add Headers enabled.

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