Write to data table from loop

I am reading an excel sheet into a data table and have created a ‘For Each Row’ activity in which I use ‘row.item(0).ToString’ to store the contents of the cell in the first column to variable called ‘strMessageText’ which I then use to write to an application and click a button to submit. This part works fine.

What I would like to do is write the time and date the button is click back to the the corresponding cell in column 2 of the spreadsheet (Column header is Date Time). I have captured the time using ‘DateTime.Now’ which I have converted to a string and stored in a variable called varEndTimeStrg which I attempt to assign to the data table with ‘varWhatsAppDataTable(“Date Time”) = varEndTimeStrg’ this is where things go wrong. I get the compile error:
“varWhatsAppDataTable(“Date Time”)”. Option Strict On disallows implicit conversions from ‘String’ to ‘Integer’.

Please can someone kindly suggest a solution to this or alternative a better approach to achieving my goal.



Thank you for any assistance.

You already know that the Date Time column is the second column right, so instead of varWhatsAppDataTable(“Date Time”) try varWhatsAppDataTable(1) for column 2.

Otherwise use the add to collection activity to add the time stamp into the DataTable

it should be row("Date Time") instead of varWhatsAppDataTable(“Date Time”)

1 Like


Check below for your reference

Above will help you to assign the value to a datable

Hope this helps you