I am writing a script where I am unable to close one of the excel files open in Windows. There are many open files in Microsoft Excel but I have not opened them as f.open() in python. Before the script completes it has to write to same excel file and if file is open error and script breaks.
Can I close the one of the multiple MS- Excel Window with specific title like file1, file2, file3 are open in excel and I only want to close file2.xlsx
import os
file3= output.xlsx
os.close(file3)
writer = pd.ExcelWriter('Output.xlsx', engine='xlsxwriter')