How to insert row into excel

excel
activities

#1

Hello, I would like to insert rows into existing excel. Say I have data from row 40 to 100 and I would like to insert a row at 39 and 38 with some headers information. Please guide me how I can achieve this functionality ? Thanks


#2

Hi @suripaleru,

  1. Use the Read Range activty to load it into a datatable
  2. Get the existing rows number with the following code:
    rowsCount = myDataTable.Rows.Count
  3. Within the Write Range activity concatenate the variables in the Range property, for example:

“A” & rowsCount.ToString and thats it. It will start fulfilling your excel from this range.


#3

Hi,

I have the same question in how to insert a blank row in the middle of an excel file, say in row 12 of a total rows of 50. I cannot understand the solution mentioned above. In the Write Range activity, how can I specify the blank row in the DataTable field under the Input option ?

I have been looking for many topics in the forum, but still cannot get an answer. Appreciate your help on this.

Thanks


#4

12th row of Excel means 11th row excluding header — Index will 10.

  1. Create a DataRow variable – say dr

  2. using Assign Activtiy

    dr= dt,NewRow
    dr.ItemArray= {}

  3. Using Invoke Method

    in TargetObject — dt.Rows

    in MethodName - InsertAt

In Parameters of Invoke Method

  1. DataRow — pass your dr variable
  2. Int32 — Pass 10

#5

Great !! It works. Many thanks, Vvaidya.

Regards,
Snowman


#6

Im a rookie ! can u please explain the whole process in detail ? i want to save specific rows from a excel to another excel for example rows that contain a column value grater than 10 will be saved