Writing to multiple rows/ cells

Hi I am fairly new to UiPath. I am experimenting with the idea of reading from an excel and writing to an application. I am ok upto this bit. But the next step which is updating with the excel workbook column “Complete” with value “Yes!Completed” working out for me. The code is only able to write to one cell which is M2 , M1 is column header called “Completed”.
The code is not able to go through next row, can someone advise how can I get the tool to write the same output in the next row.

Thanks!
Below is the tool I am using to write to cell.
image

@abhishek.singh4

use read range workbook activity for reading the excel

use for each row in datatable activity

inside use

write cell workbook activity activity

change the columns as M in place of H
hope this helps

There is another solution @abhishek.singh4 :

  • Read Range and set a DT Variable in the Properties
  • Do a for Each Row
  • Inside the for Each Row add a “Update Row Item” Activity
  • Configure the Activity like shown on Screenshot below
  • After the For Each Row add a “Write Range Workbook”
  • Make sure to “Tick” the “AddHeaders” in Write Range Workbook Activity

The difference to @Shiva_Nikhil solution is, that I update the datatable (DT) within the variable and only write to Excel when finished. In the Solution Shiva_Nikhil provided it will write to Excel in each row. Sometimes this can slow down processes, especially if you work with huge excel files. Otherwise it will work just as fine.

It always depends on the use case to which solution you should use. :slight_smile:

Hi Nairda,

Thanks for your reply, when I use your method its rewriting everything the tool has read from the data table to the cell I specify in write range.

Example: In the write range when i specify L2 in the cell section. The bot is rewriting all the values from A-K in cell L. Is there a way to avoid that.

Hi Nairda,

I figured out the solution. I just had to specify the start of the column e.g A1. and even though the tool rewrote everything it read. It just replaced the existing values and the output was exactly as I wanted. Thanks for your time and effort.

Regards,
Abhishek

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