@GenAi
Lets make it simple. I go with your iterated example:

Then I pass this datatable to .Net script where it will do all the magics.
After executing .Net script:

Overall flow screenshot:

To integrate this logic into your workflow:
1. Drag and drop the .Net script into your workspace.
2. Click the Edit button on the script parameter and create a .Net parameter as shown in the screenshot below.
3. Insert the C# code as displayed below and modify it if you require a different default value (for instance, "Male" is set as the default here).
The function will accept your datatable as input, insert an "Account" column with the default value "Male," and then return the updated datatable.

Full workflow code (To understand how it works, simply copy and paste the full workflow code into your PAD flow):
Variables.CreateNewDatatable InputTable: { ^['Name', 'Age'], [$'''Sam''', 10], [$'''Peter''', 22], [$'''Mike''', 30], [$'''Ray''', 40] } DataTable=> Header_048
Scripting.RunDotNetScript Imports: $'''System.Data''' Language: System.DotNetActionLanguageType.CSharp Script: $''' // Check if the Gender column already exists
if (!dt.Columns.Contains(\"Gender\"))
{
// Add the Gender column with default value \"Male\"
DataColumn genderColumn = dt.Columns.Add(\"Gender\", typeof(string));
genderColumn.DefaultValue = \"Male\";
// Set default value for existing rows (if any)
foreach (DataRow row in dt.Rows)
{
row[\"Gender\"] = genderColumn.DefaultValue;
}
}''' @'name:dt': Header_048 @'type:dt': $'''Datatable''' @'direction:dt': $'''InOut''' @dt=> Header_048
Thanks,
Deenuji Loganathan 👩💻
Automation Evangelist 🤖
Follow me on LinkedIn 👥
-------------------------------------------------------------------------------------------------------------
If I've helped solve your query, kindly mark my response as the solution ✔ and give it a thumbs up!👍 Your feedback supports future seekers 🚀