Excel Import: Could not execute code stage because exception thrown by code stage: A column named 'Title' already belongs to this DataTable.

Srikanth

New Member
When i try to import the contents of an excel in to a collection, I get the below error.

Internal : Could not execute code stage because exception thrown by code stage: A column named 'XXX' already belongs to this DataTable.

I was able to do the import successfully for the first time (where it read the column names and saved those values in to corresponding collection item). And when i try running it for the next time (importing the same sheet withe different set of data but with same column names), I am getting the error as shown above.
 

VJR

Well-Known Member
Hi Srikanth, have you ever renamed any column and then changed it to something else and back to what it was earlier. This usually does happen when the columns are renamed since for some reason BP doesn't appear to recognize the most recently updated column.
If Reset, Refresh, and closing & re-opening Blue Prism does not resolve the issue then some screenshots of your collection and excel would help if they are not confidential.
 

Srikanth

New Member
Hi VJ,

Yeah I did rename the columns and now it worked after closing and re-opening the blue prism. Thank You!
 
  • Like
Reactions: VJR

sandeep

New Member
Hi I am also facing the same issue, after multiple restarts also i am unable to solve this issue, can you help me how to sort this.

After multiple restarts also facing the issue.
 

Bhaskarr

New Member
Hi I am Facing the below , could you please help me .
Internal : Could not execute code stage because exception thrown by code stage: Method's type signature is not Interop compatible.
 

VJR

Well-Known Member
Hi I am Facing the below , could you please help me .
Internal : Could not execute code stage because exception thrown by code stage: Method's type signature is not Interop compatible.
Hi Bhaskarr,

The title of the thread is different than the error in your post.
Can you elaborate full details like what are you trying to do, which action throws the error and some screenshots could help.
 

Bhaskarr

New Member
Okay, While run the loop, first iteration am getting the data in excel.but second iteration am getting the this error in write collection action.please find the system exception below :Internal : Could not execute code stage because exception thrown by code stage: Method's type signature is not Interop compatible.
 

Attachments

  • Screen Shot for Exception.png
    43.7 KB · Views: 220

veena

New Member
I am also getting that kind of error. Please see screenshot
 

Attachments

  • Capture.PNG
    34.3 KB · Views: 146

VJR

Well-Known Member
Hi Bhaskarr and veena,

I've used this action and haven't yet faced this error message.
Probably it could be due to the data or a column with a specific data type you are having that is causing the error.
So you might want to try out a few things and some of which are as below.
-If you are able to remove some data that you think could be questionable then remove them and retry again.
-Another option is to pinpoint the exact line of code that is causing the error. This can be done by commenting out certain number of lines from the 'Write Collection' code from the bottom and then running the action. If the error does not occur then it means it is among the lines of code that is commented. Then remove some of those comments. If it throws an error then you need to comment a few more lines and continue the same till the exact line is found. When a single line is uncommented and the action starts throwing the error then you have caught hold of the exact line.
Check if there is a way to find the exact line of code using a Try Catch block.
This requires in depth analysis but would encounter the line that is causing the issue to take the necessary steps. You might want to take a backup of the excel vbo or the Write collection action and then make changes to its code.
- Although this link is about a Datagrid whereas a Collection is a Datatable in Blue Prism, but searching for some weblinks like this suggests that adding a ToString() at the place where the data is getting copied into the Excel resolves the error message. This link has a C# code so you need to find its corresponding VB code since the excel vbo is written is Visual Basic.
 

Leon Zwinderman

New Member
The problem I faced with the Error: "Method's type signature is not Interop compatible", was that I was trying to write a TimeSpan data item into the Excel file. Didn't work so changed the TimeSpan data item to a Text data item
 
Top