Write SAP output to Excel


#1

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.


#2

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)


#3

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


#4

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)


#5

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


#6

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


#7

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.


#8

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


#9

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.


#10

F+rowIndex.ToString


#11

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


#12

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


#13

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.


#14

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.


#15

Can your attach your xaml


#16

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)


#17

“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)

“F”+(rowIndex+2).ToString


#18

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


#19

How many rows the robot should read from excel?


#20

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