Click here to Skip to main content
15,895,667 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hai all,
Is possible to write data to excel while excel is open? Using EPPLUS library

I can do it if use interop service, but the problem is can't close EXCEL.exe in task manager.
I have tried to close with many way, but still get failed.

So, now i move to EPPLUS library, because EPPLUS create or and add excel data and then close it automatically.
Now the problem is, i cant write data to excel while excel is open.
Is possible to do it?
Thank you
Posted
Comments
[no name] 7-Jul-14 14:05pm    
No you will get exception that the file is opened by another user.
ZurdoDev 7-Jul-14 14:54pm    
Yes, in general you can. You can't reopen the file as sankarsan is alluding to but you can get a handle on the existing instance of Excel. However, I know nothing of EPPLUS so I would check their documentation.
bonjot 7-Jul-14 14:57pm    
okay thank you.
i have slidden my mind, maybe use how to prevent user to open the primary file which accessed by program.
i found it.
sorry for my bad english, thank you.

1 solution

You don't need to give up with Interop. All you need to do is to release Excel objects.
How? Please, see: Releasing Excel after using Interop[^]
More information about your issue you'll find using Google[^].
 
Share this answer
 
Comments
bonjot 8-Jul-14 12:46pm    
i have did it, releasing excel object and workbook.
maybe sometime i'll try again with code in that link. :D
now i want to try using epplus, it write data to excel faster than excel interop, and so simple how to use.
I want to ask again about EPPLUS, how to add series value to existing chart? Using EPPLUS, i still can't find the way yet.
thank you

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900