I need to copy data from one workbook to another and paste it on the last row.
I am using a read range activity and want to write the range into another worksheet’s last row. Understand that I can use append rage activity. However, the two worksheets does not have identical columns.
Example, I am reading from A1:C1 from workbook 1 sheet 1 and would like to paste to D1:E1 in workbook 2 sheet 2. See that I cannot specify columns under append range activity. What other alternatives do i have?
If we are aware of the column position then we can use WRITE RANGE activity and alongside if we know the row number as well we can keep set of records one below the another from the specified row and column
To know the last row number we can use The .net method for retrieving the number of rows in a datatable is
Gives the last row position in a excel
Thanks @Palaniyappan .
Can I confirm that it is to write datatable.Rows.Count+2 under write range activity?
For my example, I do know the column.
After I use the read range activity to copy A1:C1 from workbook 1 sheet 1, I want to write on the last row of column D:F in workbook 2 sheet 2.
The current last row is 142 and I want to write on 143. However, the last row will always change when I run the sequence so and I cannot specify it as 143.
You need to use this expression in the write range:
"D" + (datatable.Rows.Count+2).ToString
If you want to do it multiple times, in order to update the index of the last row, the data table needs to be read prior to the write range activity.
Mention like this
Anyhow we are using row count
So it gets managed automatically