Write SAP output to Excel

SAP - creating documents from an input data table. For each row on the input data sheet, SAP is creating a document number. I need to write this Doc # as output at the end of each row in column F on the input data sheet.

1 Like

You can use “Write Cell” with Cell# as F+rowNumber.ToString

If you are using foreach row, dtTable.Rows.Index(row)+2 gives RowNumber(If youhave column header , else +1)

Thanks - when you say if I have the column header, else +1??

Excel starts from 1, datatable starts from 0.

If u want to update 2nd row in excel assuming 1st row is columns header.

1st datarow—F+(rownumber+2)

Thanks but still can not get the number to go at the end of each row.

Try with write cell and check to which cell it is going. Then use that logic inside Foreach.

That’s my issue - I don’t know what logic to write! It goes in F2 but the next doc does not go into F3.

Are you using Foreach Row? If so it should go to F3

I have a read range - variable created and assigned to for each row. I then added an assign for rowIndex and added DT.row.index(rownumber)+1. Then I added the write cell F2+rowIndex. Again I should add that I have no .net experience and just started working in UiPath. Basically everything I have tried, I found on the forum or other google searches. If you could walk me thru what the activities should be and the values - I would greatly appreciate it.


Thanks that is what I have and it’s not working - must be something wrong somewhere else.

excelColumnRead.xaml (8.7 KB)
sample.xlsx (9.4 KB)

Thanks for you help. But unfortunately it is not working. Now it is entering and repeating each doc# starting on line 22 to 29. Like it’s reading “F2” + rowcount and starting on row F22.

Any other suggestions? It is finding the sheet and writing the scraped SAP Doc Number but it does not know to put it at the end of each row of data.

Can your attach your xaml

I am pretty sure I am misusing rowIndex and IndexOf, but I do not know what to use to get the document created to be entered into column F at the end of each row. I am attaching the two xaml and my data sheet. Again, this is my first attempt using UiPath and I have no programming background. So be kind!!

NEW ACCR ADJ.xaml (24.9 KB)
New Excel Invoke Accr Adj.xaml (7.1 KB)
New Rebate.xlsx (26.0 KB)

"F"+rowIndex.ToString instead of “F2”+rowIndex.ToString

Since you are writing to Excel (If adding header increment Index by +2, if no header +1)


Thanks for the response. It is now putting the first doc# in row 1-1423 - I had to cancel it.

How many rows the robot should read from excel?

I did not indicate - I said read range - entire sheet1.