I have a workbook with 20 columns and I need to add 4 new columns at the end namely “Old Date” , “New Date” , “Match” and “Code”. The values that would go into these columns are dynamic and are stored into 4 different variables (say a,b,c and d).
I run a for each row on the datatable (say Dt) and then assign the new columns as -
new DataColumn = Dt.Columns.Add(“Old Date”, GetType (String), a)
and similarly for the other columns using variables b,c and d. I am then writing the data table into an excel. While doing that, the output column header comes as “Old Date + (the last date)” with some random long decimal numbers in all rows of that column. For the other columns, it does not even pull the data or throws a Missing Operand ‘REP’ error.
I have been trying to work on this example. Please find attached the code and the input excel.
I added a new column named “Locality” and tried to add values to it based on certain conditions. However, I am getting only the first value even if I run the counter.
Can you please help me know where is it going wrong ?
Hi @susbasu,
I have changed a code a little without using the temp datatable. I has update with the same table. so you can use this to update more rows.
Hello , I need to add the data in a column. I have used the for each row and using get row item I am pasting the values in the excel using write cell.
It is working bt it is taking too much of time as write cell is pasting values one by one as per the loop in the column.
Do we have any other methods to do this?