Need to add values to rows in datatables

I have data collection from a web page and I have assigned them to variables. Now I have created a (built ) data table with all column names. I need to add these data to data table rows one after another.
For. ex: row A is filled with data in data table now in 2nd iteration row B should be filled with data likewise we need to complete the data table rows

the issue that I am facing is: the values in the data table are getting overlapped and the final output is only one data row with last iteration data.

I have tried using the add data row but it is not working and the values are getting added to the same data row instead of the next row.

Can anyone have a sample XAML file to help me out?

Thanks in advance

Hi @deepaksvg99

Are u defining the build datatable activitiy inside the loop

If yes then put it outside the loop then use add datarow inside the loop

To view the final data in Excel file use write range activity outside the loop to get all data in datatable to.be written in excel file

  1. read data that you want to add into datatable.
  2. roop these data
  3. make new row by DataTable’s NewRow Method
    ex) dt <- DataTable you made already
  4. fill data into new row with #1 data
  5. add new row into datatable by DataTable’s Rows Attribute’s Add Method
    ex) dt.Rows.Add(newrow) by Invoke Method Activity

good luck

Hello,

1.Read the data using Read Range activity.
2.Use Assign activity to increase the count(eg : RowCount = Datatablename.Rows.Count+1)
3.Then you can built the datatable using Build Data Table activity.
4.Add data row using Add Data Row Activity.
5.Then as a last step we need to write the data using Write range activity and can give (eg :“A”+RowCount.ToString ) in the starting cell of the Write Range Activity.

Thank you

1 Like

Hi Nived,
Thank you for the suggestion,
Actually, I was putting the data table inside the loop

@deepaksvg99

check below for your reference
https://forum.uipath.com/t/tutorial-how-to-calculate-difference-between-two-time-values-using-uipath/247565/3

Hope this helps you

Thanks