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
Hi @suripaleru,
- Use the Read Range activty to load it into a datatable
- Get the existing rows number with the following code:
rowsCount = myDataTable.Rows.Count - 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.
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
12th row of Excel means 11th row excluding header — Index will 10.
-
Create a DataRow variable – say dr
-
using Assign Activtiy
dr= dt,NewRow
dr.ItemArray= {} -
Using Invoke Method
in TargetObject — dt.Rows
in MethodName - InsertAt
In Parameters of Invoke Method
- DataRow — pass your dr variable
- Int32 — Pass 10
Great !! It works. Many thanks, Vvaidya.
Regards,
Snowman
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
why are you using dt variable? where it comes from?
Help please, TY!
I will really appreciate if someone can explain this answer illustratively!!
