cancel
Showing results for 
Search instead for 
Did you mean: 

Failed to copy and paste in excel sheet

NiranjanKumar
Level 2

I am getting below error while running Blue Prism code, actually i am filtering duplicate and Unique value from Main excel sheet and pasting to another excel, how ever it is running fine in Debug mode. but getting errror while running the process using Blue Prism Desktop. Any help or suggestion to fix this issue.

Error : Failed to copy worksheet: Current thread must be set to single thread apartment (STA) mode before OLE calls can be made, Ensure that your main function has STAThreadAttribute marked on it.



------------------------------
Niranjan Kumar
------------------------------

1 REPLY 1

PvD_SE
Level 12

Hi N,

As a workaround you could copy the from-XL into a collection, then do your duplicate filtering on that collection, and finally write the filtered results from the collection to the to-XL.



------------------------------
Happy coding!
---------------
Paul
Sweden

(By all means, do not mark this as the 'Best answer'! )
------------------------------
Happy coding!
Paul, Sweden
(By all means, do not mark this as the best answer!)