Assign Data in Last Column of Each Row of a datatable


I Have 6 Columns in CSV file stored in dt table, 7 th Column of CSV is the Output in a Application , want to capture that value and want to keep in the last 7 th column of dt and take the output in new CSV.
Below is what I did our put throwing exception. Please check and correct

Below Is the exception



Well, you’ll have to show also the details of the exception. I can think of two things: you did not use Add Data Column to add a column to the DataTable so the index 6 is out of range, or ClaimNo is null and the column does not allow null entries.


After adding the column name to the datatable.

just take one for loop with the updated datatable and
assign-------row(7)=“your value”
write csv…

for loop end.