Populate a Windows Form from a Data Table


I’m still very new to UiPath Studio, so please forgive if this is a silly question, but I need some help.

I have a spreadsheet with some test data - Name, Surname, Date of Birth etc, and I want to populate the fields of a Windows form using this data. When the first line of the test data has populated the Windows form, the form is saved. And then I want the second row of the test data to populate the form, and so on until all rows of the test data have been used.

I’ve used Excel scope/Use Excel File/Read Range to read from the excel spreadsheet and save the test data to a data table (called dtTestData), but I’m not sure what to do next. Would I use a ‘For Each Row’ of the data table? If so, how would I do this?


Yes. You can then reference each field for the current row you’re iterating, and populate your form however you need. datarow reference would be something like: CurrentRow(“YourFieldNameHere”).ToString

Examples below.
Red=Default object - no need to declare it or create the variable, it is created when the activity is made and only used in this loop’s scope
Blue=Your DataTable variable name
Body sequence is where you would put your code to fill in the form.

Result of the Write Line Activities from above:

Hi @paul.parkes Follow below steps

  • Read excel data to data table(as you said)
  • Loop through data table using For Each Row in Data Table activity
  • Within the loop, get each row value,enter in the windows form and save
  • This loop repeats for all the rows in data table

Below link on how to get the data from the data table

Thank you for your help, but I’m getting a validation error:


I’m not sure what I’m doing wrong :frowning:


Are you using a c# project?

If yes then use like this CurrentRow["Nominal"].ToString()

Hope this helps


@paul.parkes Are you using VB.Net based process or C#. What I gave you was for VB. C#, I think, might look like this:


Hey Scott, yeah my bad, I guess I should’ve mentioned I was using C#. Yes, 'CurrentRow[“FieldName”] worked perfectly! :slight_smile:

Thank you so much for your help!

Yeah, I neglected to mention I was using C#. CurrentRow[“Nominal”].ToString() worked like a charm :slight_smile:


1 Like

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