Using powershell can I kill/force close a single window (excel workbook) running under Excel without killing the whole process which closes all excel workbooks running under that same process instance? I can search for processes named Excel, and check if the window title contains "myworksheet.xlsx" and then kill the process. But if there were any other workbooks open under the same process then those also get killed:
Get-Process | Where-Object {($_.ProcessName -eq "Excel") -and ($_.MainWindowTitle -match "TeamWorkbook.xlsx")} | Stop-Process -Force
The background is simply that my group uses a spreadsheet which is only writable by one person at a time. Occasionally someone leaves it open on their computer and they go away and then no one else can write to the spreadsheet.