Error -Value of type ‘String’ cannot be converted to ‘System.Data.DataTable’

Getting the error -Value of type ‘String’ cannot be converted to ‘System.Data.DataTable’

Can someone please help me to resolve the issue

@vaibhav2.chavan
in readrange you do readin the excel data, this outputs a datatable - should be InputData in your case refering to screenshot
this datatable Variable (InputData) has to be used within the for each row
So change the Variable FeedData to InputData on the for each row activity

Fine

You were almost done

Usually FOR EACH ROW activity will take input as datatable
For more details on its properties

So that input can be obtained from READ RANGE activity
Use the output variable from read range activity directly with FOR EACH ROW activity
I hope you have used the output of OUTPUT DATATABLE ACTIVITY and it’s output will be of type STRING
that’s why this issue came up

Kindly try this and let know for any queries or clarification
Cheers @vaibhav2.chavan

The use case for the Output Data Table activity is for when you want to convert the data table to a string to display in a message box or write line for debugging, or you can use that string to manipulate the values as a string, or you can output the table to a text-based file (csv or txt for example).

So as mentioned, You wouldn’t use that activity if you will be looping through the data table, so you can pretty much remove that activity, and use InputData in the For each instead

Regards.

1 Like