I'm using the following code to open and display a workbook within Excel:
import win32com.client as win32
excel = win32.gencache.EnsureDispatch('Excel.Application')
wb = excel.Workbooks.Open('my_sheet.xlsm')
ws = wb.Worksheets('blaaaa')
excel.Visible = True
When the File 'my_sheet.xlsm' is already opened, Excel asks me whether I want to re-open it without saving.
How could I check in advance whether the workbook is already opened up and in case it is, just bring it to the front?
EDIT: Found out by now:
if excel.Workbooks.Count > 0:
for i in range(1, excel.Workbooks.Count+1):
if excel.Workbooks.Item(i).Name is 'my_sheet.xlsm':
wb = excel.Workbooks.Item(i)
break
And one more question: My worksheet contains some hea