How to get information into a specific cell in excel

Hey everyone UiPath noob here again,

So my intention is to gather names from an excel sheet - search those names in a web app - locate the
ID numbers of those names - place those ID numbers in a separate column in that same excel sheet in
the same row as the name that corresponds with that ID number. Obviously I have to use a loop for the
multiple rows in the excel sheet, so when I use the ‘write cell’ activity’ I imagined the correct thing to do
would be to write “row.Item(6).ToString” in the range field, but when I run it I get “Write Cell: Cannot find column 6”.

What’s the correct way to specify a column?

All answers are much appreciated!

Hi @jakem45, if you want to specify a column based on column number, you need to use Row.IndexOf() and specify the column number in the bracket (you can check out an example here: Insert data in specific cell of excel), but if you want to use Row.Item(""), then within the quotations, you need to specify the name of that column. Eg: Row.Item(“Total”).toString. Hope this helps!

1 Like

Thank you so much the link you provided worked!!

The only issue now is that it’s adding the info in the first row, the row that’s supposed to be the column.

And out of curiosity do you know what the ‘2’ does in: “E” + (DT.Rows.IndexOf(row)+2).ToString ?

Thanks again this was such a headache haha

Edit: well changing the 2 to a 3 put it in the right place!

1 Like

I’m so glad it worked @jakem45! Could you please mark my answer as a solution? It’ll help others with the same problem in the future! Thanks!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.