Column does not belong to table - but writing the table shows it does?

I am having a problem where I am trying to use a For Each Row activity to add a data row when a criteria is met, however, I am getting an error that one of the column names I am trying to add does not belong to the table. See below:

I am printing the specified data table to an excel sheet to verify the column names, then I am reading it back to make sure the DT variable has values.
image

The Excel sheet shows that the column exists in the table.
image

Here I am trying to write the values to a new table using the For Each:
image

This is the error I am getting:
Exception Occured during Process Column ‘Co’ does not belong to table . Source Invoke BuildCompleteReport workflow: Invoke MasterQueryToCompComCensus workflow: Add data row.

I’m at my wit’s end with this. Any help would be greatly appreciated.

Check if there are any extra spaces in column name “Co” in excel sheet.

3 Likes

I thought that, too. I actually copied the exact column title and copied it into my Add Data Row activity.

Here’s a picture of the column title, for reference.
image

Check if the Datatable was read correctly by write CSV of same Datatable.

Also, have u made add headers true in read range?

1 Like

I am already checking the Datatable by using a Write Range activity and it is giving me the expected output. Would using a write CSV activity show me anything different? I am happy to try it.

Also, yes, I have made add headers true.

I am stumped.

Inside for each, check writeline of row(“Co”).tostring

I tried to write as CSV and it also shows that Co exists.
image

I just tried to use a Write Line activity and it is giving me the same error: Exception Occured during Process Column ‘Co’ does not belong to table . Source Invoke BuildCompleteReport_HRCompRpt workflow: Invoke MasterQueryToCompComCensus workflow: Write line

Try it with index like row(0).tostring

This is too weird. I just changed the file to have the column title “Company” and then did the same thing, it gave me the same error, so then I changed it back to “Co” and then I added a message box to show the # of rows outside of the loop, and inside of the loop. It gave me the same number.

So then I just copied the name of the data table from the arguments pane and pasted it into the For Each Row, and now it is working just fine.

The weird part is, it is exactly the same thing. The title of the argument is exactly the same…
image

Compare to the first screenshots I posted.

1 Like

Thank you for your responses and patience with my apparently non-existent problem…

2 Likes