Welcome to the thrilling world of DataTables in UiPath where spreadsheets meet mild chaos and automation makes it bearable. This guide walks you through creating a DataTable, defining columns with the Build Data Table designer or Add Data Column at runtime, populating rows with Add Data Row or bulk reads, processing rows with For Each Row, and finally exporting with Write Range or Output Data Table. Yes this is the part of RPA that looks boring but actually runs your life.
Start by making a DataTable variable. Give it a clear name like dt
so future you does not scream at past you. In the Variables panel set the variable type to DataTable
. If you like ceremonies you can use an Assign activity to initialize it with dt = New DataTable()
but the Build Data Table activity will do that for you too.
You have two friendly paths here. Use the Build Data Table designer when you know the schema up front. It creates named columns and data types so the rest of your workflow behaves itself. Use Add Data Column when the incoming data is unpredictable or you enjoy debugging interesting errors.
In the designer set columns like Name
as String and Age
as Int32. If you prefer activities use Add Data Column to append columns while the workflow runs.
For single or few rows use Add Data Row. For bulk imports use Read CSV or Read Range then assign that output to the dt
variable. Here is a tiny example of adding one row with the ArrayRow property.
ArrayRow = { "Alice", 30 }
You can also create a DataRow object, fill fields, and add it with Add Data Row. Both paths are valid and both will judge you equally.
Use For Each Row to iterate and manipulate data. Access values by name like row("Name").ToString
or by index. Use Assign to transform values and Write Line or Log Message to peek under the hood while debugging. Example pseudocode is below.
For Each row In dt
name = row("Name").ToString
age = Convert.ToInt32(row("Age"))
' do something like Assign and Log Message
Next
To get the DataTable into Excel use Write Range and point to a Workbook or an Excel Application Scope. For a quick console friendly view use Output Data Table to convert the table to text then Write Line. Both work and both will cheerfully leak schema issues into your logs.
There you go. You now know how to build a UiPath DataTable, add columns and rows, process each row with For Each Row, and export the result with Write Range or Output Data Table. Use these patterns in your RPA projects and enjoy the rare thrill of a working workflow on the first run or at least on the second run with fewer cursed variable names.
I know how you can get Azure Certified, Google Cloud Certified and AWS Certified. It's a cool certification exam simulator site called certificationexams.pro. Check it out, and tell them Cameron sent ya!
This is a dedicated watch page for a single video.