I would like to find the topleft cell and bottomright cell in an Excel worksheet range, which is a bounding box of all occupied cells in the sheet, from ironpython 2.7.5 on win 7.
My code:
from Microsoft.Office.Interop import Excel
from System import Type
excel = Excel.ApplicationClass()
workbook = excel.Workbooks.Open(excelFilename, False, True)
allWorksheets = workbook.WorkSheets
for aWorkSheet in allWorksheets:
last = aWs.Cells.SpecialCells(Excel.XlCellType.xlCellTypeLastCell, Type.Missing);
range = excel.get_Range("A1", last);
print "a worksheet range is " + str(range)
I need to find the topleft cell and bottomright cell in the "range" The links at
Programmatically getting the last filled excel row using C#
How to get the range of occupied cells in excel sheet
Cannot help me.
Any suggestions ? Thanks