gdemin / excel.link

Convenient Data Exchange between R and Microsoft Excel
56 stars 16 forks source link

After using excel.link, Excel doesn't shutdown completely #27

Open DataConnection opened 2 years ago

DataConnection commented 2 years ago

I have a R script that writes something to Excel, then the script ends. When I afterwards close Excel, Excel does not shut down completely, but stays as a hidden instance in Task-Manager. Steps to reproduce: Open empty Excel file "Mappe1.xlsx" Run script:

library(excel.link)
xl.workbook.activate("Mappe1.xlsx")
xl["a2"] <- 1
xl["c1"] <- 2

Close (all open) Excel files. In Taskmanager, the instance of Excel is still running.

Is there a possibility to detach the COM connection? Would be great if there is a solution - and thank you very much for the package!

Wolf

gdemin commented 2 years ago

I fought with this second instance for a long time without success. I am not sure if it is due to the excel.link. Sometimes I have the second Excel instance without the excel.link usage. Perhaps, it is intentional Excel behavior for the quick restart. Try it by yourself: run Excel, do something with it without R/excel.link and close Excel. High chance that you will get the hidden instance after that.