How to write data to particular column using for each row in excel

datatable
excel
loop
uiautomation
sap

#1

i’m automating the purchase order creation and updation in SAP. i need to know how to add column data to excel through for each row because i’m getting the value from for each row iteration when it first row iteration it have to store the purchase order number in excel file column(PO No) and it’ll store dynamically in same column based on the how many items are available in the excel pls guide me to do this process.


#2

@Prakash_Raj In Foreach row using assign statement u can do it

row(6)=ur variable/value u want store.

After each write again dataTable to excel. where 6 is the column number


#3

i need to write column in each row


#4

@Prakash_Raj In For each row it automatically get incremented to next row. U need not to worry about it. That statement is enough. Try once once and let me know, if it works for You.


#5

@Prakash_Raj Otherwise u can Use build datatable activity create one column assign it dataTable varibale. In for each row use add data row activity, to add values to that column. After for each row use write range activity to write this dataTable with starting range as “G2”


#6

it will works when im giving assign activity as row.item(“PO No”)=myVariable. and i need to print the column in same excel how to i do that


#7

@Prakash_Raj

I didnt get you


#8

it works fine in data table but i need to put that value in same excel.


#9

@Prakash_Raj use write range activity to write to excel sheet.


#10

how to get the specific column as datatable.


#11

@Prakash_Raj Try below one

Use build datatable activity to create datatable with one column assign it dataTable varibale. In for each row use add data row activity, to add values to that column. After for each row use write range activity to write this dataTable with starting range as “G2”


#12

please refer any sample xaml file.


#13

i cant understand your flow @Manjuts90


#14

@Prakash_Raj For your reference check below workflow.

Seq----.xaml (11.6 KB)

let me know if u have any doubts in it