Write range into a specific column without overwrite old data

HI All,

i am new to RPA program. i already try many way to paste the data table into a specific column but failed. please help me. thanks in advanced!

Hi @PME_RPA

Write Range activity will overwrite the old data, if you want to use the write range without overwriting the old data then you need to find the last used row and pass row number in the Range property

Thanks
John

data will be added by weekly.do you have any recommend instead of using write range? i am also need to paste the data to “Specific column” created.

You can follow the example given below

I am writing data into D column which already have some data.

  1. Read Range will give dt_RowOuput, from this output I will find out how many rows are there in the excel.
  2. Used Remove Data Row to Remove the header in the data table to avoid writing header for every new entry
  3. In the Write Range activity, I will pass the Range value as below, so bot will update the new data under old data.

“D”+(dt_RowOutput.Rows.Count+1).ToString

Note: Uncheck Add Header option in the Write Range activity

Thanks
John

Got ERROR
Remove Data Row: Object reference not set to an instance of an object.

Hi @PME_RPA

Can you share the screenshot of Sheet2 and DT1.
Knowing how the column headers and structure look will help in resolving the issue.

Hello @PME_RPA

If you use Write Range it will overwrite the existing data. So try to use the Append Range activity and write to the respective column. It should work.

Thanks

may i know how to write respective column? i try many ways cannot

Hi @PME_RPA

Remove Data Row did not work like I expected. so here is a modified approach.

Step 1: When Reading the DT1 table, read from next row to avoid headers

For Example, A1 row contains headers for the table. so, I am reading from A2 row

Step 2: In the write range activity pass the Range value as below, so bot will update the new data under old data.

“B”+(dt_RowOutput.Rows.Count+1).ToString

@PME_RPA

Try to do as below.

Use Write Datatable to Excel activity and enable Append property.

image

Thanks

i try this method but the data keep overwritten.

may i knowwhich package activieties?and the version. thanks!

Hi All,
i got the answer. same as johnfelix… thanks All
image

1 Like

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